In this article I will explain how to solve the following error in ASP.Net application when hosted on IIS server.
HTTP Error 404.13 - Not Found The request filtering module is configured to deny a request that exceeds the request content length.
The above error occurs when one tries to upload a file larger than the maximum allowed limit.
Problem
Solution
In order to resolve the above error, the maximum upload File Size Limit needs to be increased (as per requirement) in Web.Config file in the following two locations.
1. maxRequestLength setting – Default value is 4096 MB i.e. 4 MB.
2. maxAllowedContentLength setting – Default value is 30000000 Bytes i.e. 28.6102 MB.
Setting the maxRequestLength and maxAllowedContentLength settings in the Web.Config file
In the Web.Config file, the maxRequestLength and maxAllowedContentLength settings are set as shown below.
The maxRequestLength setting accepts value in KB and it is set to 1048576 KB i.e. 1 GB and the maxAllowedContentLength setting accepts value in Bytes and it is set to 1073741824 Bytes i.e. 1 GB.
<?xml version="1.0"?>
<configuration>
<system.web>
<!-- 1GB in kilobytes, default is 4096 KB or 4MB-->
<httpRuntime maxRequestLength="1048576" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- 1GB in Bytes, default is 30000000 or approx. 28.6102 MB-->
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</configuration>