How-to enable large file uploads in IIS7

By ramon
March 13, 2009
1

We have migrated from IIS6 to II7 and today we had some problems with large file uploads which we didn’t have with ASP.NET on IIS6. The web application was already configured to allow large file uploads:

<system.web>
    <httpRuntime maxRequestLength=”153600″ executionTimeout=”900″ />
</system.web>

So WTF is happening? Well IIS7 request filtering was kicking in and we needed to configure it and this can be done too in the web.config:

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

But this still didn’t work for us because the default permission in IIS7 is that applications are not allowed to alter this setting. Configuring the setting with appcmd on an elevated command prompt made it all work again:

appcmd set config "wms/wmsdev" -section:requestFiltering -requestLimits.maxAllowedContentLength:157286400

Be aware though that maxRequestLength is specified in kilobytes and maxAllowedContentLength in bytes.

Comments: 1

  1. Ramon Smits says:

    You are right about the error as “wms/wmsdev” was the website that existed on that server. You need to target your own specific website there :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta