Thursday, August 30, 2012

Maximum File Upload Size in IIS 7

I have investigated and done a lot of testing as the information online is somewhat inaccurate/misleading.  In the end i Determined that the following setting all need to be configured to allow for large file uploads.  If not the default settings will stop uploads greater then about 20 MB.

The following change need made to the web.config file.
    <httpRuntime requestValidationMode="2.0" executionTimeout="600" maxRequestLength="2000000" />
        <requestLimits maxAllowedContentLength="2000000000" />

The executionTimeout is extending the maximum script execution to 10 minutes witch will be required for larger uploads.  The maxRequestLength is the maximum size in kilobytes while the maxAllowedContentLength is the same maximum size but in bytes.  So maxAllowedContentLength should be 1000 times the maxRequestLength.

These numbers of course can be adjusted as needed.

On a final note you may want to check C:\Windows\System32\inetsrv\config\applicationHost.config and verify that the following line is present and set to Allow.
<section name="requestFiltering" overrideModeDefault="Allow" />

No comments: