65.9K
CodeProject is changing. Read more.
Home

IIS 7 needs extra configuration to allow large file uploads

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Apr 14, 2010

CPOL
viewsIcon

35924

Whilst uploading a large (70MB) file to an IIS 7 website I got a 404 error….which was odd, uploading a file in a postback shouldn’t give me that. I know that file exists!On further investigation it turns out it was actually a 404.13 error from the Request Filtering feature of the Integrated...

Whilst uploading a large (70MB) file to an IIS 7 website I got a 404 error….which was odd, uploading a file in a postback shouldn’t give me that. I know that file exists! On further investigation it turns out it was actually a 404.13 error from the Request Filtering feature of the Integrated Pipeline (More Info[^]). To fix this I needed to add some additional configuration to the <system.webServer> element on top of the <httpRuntime> modifications – note the subtle change of units!
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <!-- maxRequestLength and requestLengthDiskThreshold is in Kilobytes-->
        <httpRuntime maxRequestLength="204800" requestLengthDiskThreshold="204800" />
    </system.web>
    <system.webServer>
        <security>
            <requestFiltering>
                <!-- maxAllowedContentLength is in Bytes not Kilobytes -->
                <requestLimits maxAllowedContentLength="204800000" />
            </requestFiltering>
        </security>
    </system.webServer>
</configuration>