IIS request filtering
- Setting
requestLimits maxAllowedContentLength- Default
- 30000000
- Unit
- bytes (about 28.6 MB)
Fix an IIS 413 or upload limit: maxAllowedContentLength, ASP.NET maxRequestLength, Kestrel and classic ASP limits, each with its unit and default.
IIS has several upload limits in different units. Request filtering's maxAllowedContentLength defaults to 30000000 bytes, ASP.NET's maxRequestLength to 4096 KB, ASP.NET Core's Kestrel limit to 30,000,000 bytes, and classic ASP's maxRequestEntityAllowed returns a 403. Raise the one that fires, in the right unit, and mind that IIS may show a 404 for the request filtering case.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
web.config.requestLimits maxAllowedContentLengthhttpRuntime maxRequestLengthMaxRequestBodySizeasp limits maxRequestEntityAllowedIIS's status code reference lists 413.0 Request entity too large: the request is made by using a payload that is too large. Microsoft's requestLimits page adds a twist: when request filtering blocks a request over the limits, IIS returns an HTTP 404 to the client and logs a substatus, with 413.1 Content Length Too Large for the content length case. So the browser may not say 413, and the log is where you confirm it.
You can also edit it in IIS Manager: select the site, open Request Filtering, then choose Edit Feature Settings in the Actions pane.
The value is in bytes. 300 MB is 300 x 1024 x 1024 = 314572800. Setting it for the whole server is rarely needed; set it on the site or the upload path.
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="314572800" />
</requestFiltering>
</security>
</system.webServer>
</configuration>maxRequestLength, Microsoft describes it as a limit for the input stream buffering threshold, with 4096 KB as the default.<system.web>
<httpRuntime maxRequestLength="307200" />
</system.web>builder.WebHost.ConfigureKestrel(serverOptions =>
{
serverOptions.Limits.MaxRequestBodySize = 100_000_000;
});
// or per action
[RequestSizeLimit(100_000_000)]
public IActionResult Upload() { /* ... */ }Find the failing request in the IIS log for the site and read the status and substatus columns.
Raise the layer the log points to, using bytes for IIS and Kestrel and KB for maxRequestLength.
Send a file just over the old limit and under the new one; confirm a 2xx.
A load balancer or CDN may have its own body limit; test the origin directly.
3 questions people ask next, answered from the sources on this page.
Request filtering's maxAllowedContentLength defaults to 30000000 bytes, about 28.6 MB. ASP.NET's maxRequestLength defaults to 4096 KB.
Microsoft's requestLimits documentation says request filtering returns an HTTP 404 to the client for requests over the limits and logs a substatus such as 413.1 Content Length Too Large. Check the log.
Change the layer that rejects the request. Hosting ASP.NET Core under IIS means both IIS request filtering and Kestrel can apply, so raise both if you raise either.
Run the free audit, then approve the fixes. Every change can be undone.