Ramon Smits

Tell me your secrets and i'll tell you mine

Recent Posts

Tags

Community

Email Notifications

Patterns & Practices / Guidelines

EntLib

Nant

Blogs that I monitor

Archives

How-to enable large file uploads in IIS7

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.

Posted: Fri, Mar 13 2009 10:57 AM by Ramon Smits | with 4 comment(s)
Filed under: ,

Comments

Dylan Barber said:

We found if you install the IIS Admin Pack then you can edit it right from the IIS admin windows in IIS7

# November 17, 2009 5:45 PM

Aamir said:

I run that command on IIS but i have faced a pro that command appcmd was not recognized as internal or external command

What should i do?

# June 20, 2012 2:07 PM

Alfonso said:

AppCmd.exe is located in the %systemroot%\system32\inetsrv\ directory

you need to "cd" to that directory, then excecute the line above.

BUT, is giving me an error:

( message:Cannot find SITE object with identifier "wms/wmsdev". )

# September 18, 2012 3:56 PM

Ramon Smits said:

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 :)

# September 19, 2012 1:12 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 6 and 7 and type the answer here: