HTTP Error 404.13 – Not Found: deny a request that exceeds the request content length

Recently I have encountered an error (HTTP Error 404.13) while uploading a 72 MB file with my ASP.NET web application. On researching, I figured out the problem is due to the default request content size limit restriction.The file upload size limit is restricted in the requestFiltering Settings under requestLimits element’s maxAllowedContentLength attribute. If you are not specifying the value for maxAllowedContentLength in your application’s web.config file, then the IIS will consider the default value. The default value of maxAllowedContentLength in IIS 7 to IIS 10 is 30,000,000 Bytes i.e. 28.6 MP. When you try to upload a file with the size above 28.6 MP, then it will return the 404.13 error as seen here. To fix this problem follow the steps given below.

HTTP Error 404.13

HTTP Error 404.13 – Not Found
The request filtering module is configured to deny a request that exceeds the request content length.
Most likely causes:
Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value.
Things you can try: Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting in the applicationhost.config or web.config file.

HTTP Error 404.13

Solution For HTTP Error 404.13

The solution for fixing the 404.13 error when uploading file which are larger the 28.6 MB is to override the default value of maxAllowedContentLength and maxRequestLength by adding it in the web.config file of your application with higher value. This solution will work for IIS 7 up to IIS 10.

  1. Add the below lines in your web.config file in <system.webServer> section.

    <security>
    <requestFiltering>
    <requestLimits maxAllowedContentLength=”1073741824″ />
    </requestFiltering>
    </security>

    HTTP Error 404.13 Solution

  2. Then add the below line inside <system.web>. if <httpRuntime> tag is already available, then add the attribute maxRequestLength=”1048576″.

    <httpRuntime maxRequestLength=”1048576″/>

    HTTP Error 404.13 Solution

NOTE: (1) Both the above steps are important. If you miss the maxRequestLength attribute, then you will get another error “Maximum request length exceeded” as shown below.

(2) Another important point is to specify the same size limit in maxAllowedContentLength and maxRequestLength. i.e. maxRequestLength is in kilo bytes and maxAllowedContentLength is in bytes. In order to set the content length size to 1GB set the maxRequestLength to 1048576 KB and maxAllowedContentLength to 1073741824 B.

Error: Maximum request length exceeded.

HTTP Error 404.13 Maximum request length exceeded

Related Articles

Reference

 

Related Articles & Tools

Leave your thoughts...