1. Background:
Generally, an ASP.NET web site may only accept a request with less than 4 Mb size. If you want your site can accept large file uploading, you must modify the default settings in IIS, as well as the web.config file in your web application.
2. Steps:
-
Increase the upload size limit under Request Filter Setting in IIS (Below steps applies for IIS 7, 7.5).
- Open IIS Console using INETMGR command (or IIS command) in Run window.
- In the Connections pane, select your web site under Sites node.
- In the Feature View of IIS pane, double-click Request Filtering.
- Click Edit Feature Settings… in the Actions pane.
- Under Request Limits set Maximum allowed content length (Bytes): to the value you want, and then click OK.
-
Add following code snippet in the web.config file.
- Define maxAllowedContentLength under <system.webServer>node.
-
<security> <requestFiltering> <!-- Setting maximum request size to 6MB --> <!-- NOTE: See 'httpRuntime' element above.--> <requestLimits maxAllowedContentLength="6291456"/> </requestFiltering> </security>
-
- Modify the maxRequestLength value under <httpRuntime> node. (Warning: size is mentioned in KB, not bytes)
-
<httpRuntime requestValidationMode="2.0" maxRequestLength="6144" requestLengthDiskThreshold="6144" />
-
- Define maxAllowedContentLength under <system.webServer>node.