Warning when increasing IHttpMaxRequestBodySizeFeature.MaxRequestBodySize despite all IIS limits increased
See original GitHub issueI have an ASP.NET Core 3.1 web API running on IIS on-prem (IIS 10 on Windows Server 2016). In an operation, I set IHttpMaxRequestBodySizeFeature.MaxRequestBodySize
to 262144000
. I have used the IIS Configuration Editor to
- modify
ApplicationHost.config
for my site by settingsystem.webServer/security/requestFiltering/requestLimits/maxAllowedContentLength
to4294967295
- modify
ApplicationHost.config
for my site by settingsystem.webServer/serverRuntime/maxRequestEntityAllowed
to4294967295
- modify
Root Web.config
for my site by settingsystem.web/httpRuntime/maxRequestLength
to2147483647
Those are the values I also see when I choose Web.config
in the IIS Configuration Editor.
The site is behind another IIS site acting as a reverse proxy. I have made the same changes there.
I am able to upload files larger than the default ~30MB limit, but I consistently get the following warning whenever I set IHttpMaxRequestBodySizeFeature.MaxRequestBodySize
:
Increasing the MaxRequestBodySize conflicts with the max value for IIS limit maxAllowedContentLength. HTTP requests that have a content-length greater than maxAllowedContentLength will still be rejected by IIS. You can disable the limit by either removing or setting the maxAllowedContentLength value to a higher limit.
I have even looked at the ASP.NET source code to verify that the warning only prints if you’re trying to set the limit higher than the IIS settings:
Am I doing anything wrong, or is this a bug in ASP.NET Core?
Please let me know if I can provide more information.
If it’s relevant, I am publishing to IIS using Azure Pipelines. My repo does not contain a web.config
, but for good measure I tried with the following web.config
without luck:
<configuration>
<system.web>
<httpRuntime maxRequestLength="2147483647" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (11 by maintainers)
Part of https://github.com/dotnet/aspnetcore/issues/22950 work
Fixed via https://github.com/dotnet/aspnetcore/pull/25096