In IIS 7 there is a lesser known upload file size limit of 30 megabytes. Usually this is more than enough for most Web applications, but sometimes you will want to allow your users to transfer larger files. To do so, you’ll need to update a setting in IIS.
Steps to Increase the IIS7 Upload File Size Limit
You can change the setting directly at the command line, or you need to install an IIS plug-in from Microsoft called the IIS Administration Pack. You can download the IIS Administration Pack from the following URL:
In general it’s a good idea to run IIS with this addition since it offers several useful management features such as ASP.NET authorization, request filtering, and custom errors.
Once you have installed the IIS 7 Administration pack, you can update the upload file size as follows:
- Open IIS
- Click on the site you want to accept larger file sizes
- In the main window double click ‘Request Filtering’
- On the top tab right click to see options and select ‘Edit Feature Settings’
- Now change the number in the field ‘Maximum allowed content length (bytes)’
Increase your maxRequestLength setting in ASP.NET
In addition to checking your IIS settings, it’s a good idea to check your Web.config file settings. The default file upload size allowed by ASP.NET is only 4 megabytes, so you will quickly run into a roadblock on your file uploads if you do not increase this limit.
You can update the maxRequestLength setting either directly in code or in your Web.config file.
To set your request length to 10 megabytes (which is 10240 kilobytes) in code:
configSection.MaxRequestLength = 10240;
To set your request length (in kilobytes) to 10 megabytes in your Web.config file under configuration –> system.web:
<httpRuntime maxRequestLength="10240" requestLengthDiskThreshold="10240" />
Don’t forget to also Increase your maxAllowedContentLength with IIS7 and ASP.NET
If you are running under IIS7, you will also need to set the maxAllowedContentLength Web.config property (measured in bytes) under configuration –> system.webserver –> security –> requestfiltering
<requestLimits maxAllowedContentLength="10485760" />
File Size Download Restrictions
An alternate issue that I have seen is that Internet Explorer doesn’t allow downloads beyond a certain size to happen. IE 6 had a maximum download size of 2 GB, and IE 8 supported 4GB. In the meantime, however, this size restriction appears to have been lifted with IE 10 and IE 11.
If you are still having trouble with larger downloads and older browsers, then a fix is to uncheck the HTTP Keep-Alives Enabled checkbox (found in the IIS Web site properties admin tab). Take a look at this Microsoft knowledgebase article that describes the download issue.