Few days back I got problem from my client, that he want to upload Video files to our site, which is greater than 25MB of size. He said like he was able to upload up to 18 MB but he want more, minimum he requires 25 MB, and the interesting part is that, when we tried to upload a large file, it is automatically redirected to error page, but the error is not logged. Means it is not executing the Application_Error event in Global.asax file, as we set a generic error page in Web.Config, it is automatically getting redirected. After few doing some search we got the solution. It is security feature from Microsoft IIS, which helps to avoid Denial Of Service(DOS) attacks. By default the upload size is 4 MB.
You can modify the Machine.Config file, if you apply the setting to all the applications in the machine, otherwise you can apply this setting only to a specific application / folder in the application.
Machine.Config – To all the applications in the server.
<system.web>
<httpRuntime executionTimeout="100" maxRequestLength="15000" />
</system.web>
Web.Config – Application specific.
<system.web>
<httpRuntime executionTimeout="100" maxRequestLength="15000" />
</system.web>
You can also use with location tag to allow only for specific folders.
<location path="Upload">
<system.web>
<httpRuntime executionTimeout="100" maxRequestLength="15000" />
</system.web>
</location>
Make sure you are also providing the execution timeout attribute.
If you are using IIS7, it support slightly less than 30 MB by default, and you can change it via appcmd.exe command
%windir%\System32\inetsrv\appcmd.exe set config "Default Web Site" -section:requestFiltering -requestLimits.maxAllowedContentLength:100000000 -commitpath:apphost
in this “Default Web Site” is the name of the Site you want to change the request limit.