如何在不使用web.config的情况下提供maxAllowedContentLength
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>发布于 2021-02-02 15:24:04
根据asp.net核心document,如果您没有在IIS上托管应用程序,我们可以尝试设置MaxRequestBodySize。
如果您希望在IIS上托管应用程序,则只能在web.config中设置maxAllowedContentLength,因为maxAllowedContentLength发生在MaxRequestBodySize之前。
更多细节,你可以参考下面的描述。
MaxRequestBodySize用于获取或设置HttpRequest的最大请求正文大小。
请注意,IIS本身具有限制maxAllowedContentLength,它将在IISServerOptions中设置的MaxRequestBodySize之前进行处理。更改MaxRequestBodySize不会影响maxAllowedContentLength。要增加maxAllowedContentLength,请在web.config中添加一个条目,以将maxAllowedContentLength设置为更高的值。有关详细信息,请参阅配置。
https://stackoverflow.com/questions/66004491
复制相似问题