我有一个在 IIS 上运行的 ASP.NET Core Web API。在一次操作中,我设置IHttpMaxRequestBodySizeFeature.MaxRequestBodySize为262144000。我已经使用 IIS 配置编辑器
ApplicationHost.config设置为我的网站system.webServer/security/requestFiltering/requestLimits/maxAllowedContentLength,以4294967295 
ApplicationHost.config设置为我的网站system.webServer/serverRuntime/maxRequestEntityAllowed,以4294967295 
Root Web.config设置为我的网站system.web/httpRuntime/maxRequestLength,以2147483647 
这些是我Web.config在 IIS 配置编辑器中选择时也会看到的值。
该站点位于另一个充当反向代理的 IIS 站点之后。我在那里做了同样的改变。
我能够上传大于默认 ~30MB 限制的文件,但每当我设置IHttpMaxRequestBodySizeFeature.MaxRequestBodySize为较大值时,我始终收到以下警告:
增加 MaxRequestBodySize 与 IIS 限制 maxAllowedContentLength 的最大值冲突。内容长度大于 maxAllowedContentLength 的 HTTP 请求仍将被 IIS 拒绝。您可以通过删除或将 maxAllowedContentLength 值设置为更高的限制来禁用该限制。
我什至查看了 ASP.NET 源代码,以验证警告仅在您尝试将限制设置为高于 IIS 设置([1]、[2])时才打印。
我究竟做错了什么?
如果相关,我将使用 Azure Pipelines 发布到 IIS。我的 repo 不包含web.config,但为了很好的衡量,我尝试了以下web.config但没有运气:
<configuration>
<system.web>
<httpRuntime maxRequestLength="2147483647" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3675 次 |
| 最近记录: |