IIS and large file uploads

So you have IIS installed and your nice website is up and running, just ready and waiting for users.

There’s just one problem… Whenever anyone submits a file upload they get a 404 error page… Which is a bit odd, because the pages are all there. And after a bit of testing, you spot that it only seems to happen when a file over a certain size is uploaded…

The problem is with the applicationhost.config file in %windir%\System32\inetsrv\config – it will either be missing the value maxAllowedContentLength in the <requestLimits> section. You can add or configure that section with the following command line, running as Administrator:

%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:<length in bytes>

For example:

%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:1073741824

The example above will configure the site to accept files of up to 1GB in size. After applying you’ll need to execute the iisreset command to restart your web server to pick up the new config.

Share and Enjoy:
  • Digg
  • StumbleUpon
  • Technorati
  • del.icio.us
  • Twitter
  • blogmarks
  • HackerNews
  • Tumblr
  • Posterous
  • email
Bookmark the permalink. Follow any comments here with the RSS feed for this post.
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

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

This blog is kept spam free by WP-SpamFree.