Upload limits within IIS7

Posted within Administration on

By default, IIS7 will restrict uploaded greater than 30mb. To overcome this, the following settings can be added to the web.config file within your web application.

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="157286400" />
        </requestFiltering>
    </security>
</system.webServer>

The value for the maxAllowedContentLength attribute should be specified in bytes (MB to Bytes Conversion).

See Error message when you visit a Web site that is hosted on a server that is running Internet Information Services 7.0: “HTTP Error 404.13 – CONTENT_LENGTH_TOO_LARGE”.

It can also be helpful to define the maxRequestLength and executionTimeout attributes.

<system.web>
    <customErrors defaultRedirect="~/Error.aspx" mode="On">
        <error statusCode="404" redirect="~/Error.aspx" />
    </customErrors>
    <pages />
    <globalization culture="en-GB" uiCulture="en-GB" />
    <sessionState timeout="60" cookieless="AutoDetect" />
    <httpRuntime executionTimeout="300" maxRequestLength="150000" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
</system.web>