cyprich.com

Occasionally Relevant Insights from a Software Builder

By

Fixing File Upload Size Limit in IIS 7

Windows 2008 Server and IIS 7 proved to be a real challenge in moving my old IIS 5 applications that were running on Windows XP Pro. Just when I thought everything was running smoothly, I ran into a file size upload limit which I thought I had already adjusted.

In the older IIS, I added the following code to <system.web> in the web.config file in the web application’s folder:

<httpRuntime
  executionTimeout=”100000″
  maxRequestLength=”2000000″ />

This allows a file upload of 2,000,000 kilobytes and it will time out after 100,000 seconds, or 27.8 hours. I think that if someone spends more than 28 hours uploading a file, they should send me a DVD instead.

Adjusting File Size Limit in IIS 7

The problem is that in IIS 7 on Windows 2008 Server, the web application will reject any file that is larger than 30 MB. This is a default limitation of IIS. You can increase the maximum file size by adding the following code to <system.webServer> in the web.config file:

<security>
 <requestFiltering>
  <requestLimits maxAllowedContentLength=”2000000000″ />
 </requestFiltering>
</security>

With the above maxAllowedContentLength, users can upload files that are 2,000,000,000 bytes in size. This setting will work right away without restart IIS services.

10 Responses to Fixing File Upload Size Limit in IIS 7

  1. Steve says:

    Thanks! Everyone else is having you edit the metabase with cryptic commands that alter the system configs while you have show a simple change to the web.config file. Much superior way!

  2. Johan says:

    Learning how web.config works will help you administer IIS better. There isn’t much available online with this information.

  3. Salem5 says:

    Thank you, way to go. Why ever I have to change that one file a hundred times, is way beyound me. always having to alter my files (espescially the web.config) after writing them in that visual studio development server is a pain.

  4. whitesites says:

    Thanks for the tip. Finally someone that shows you a simple way to get this done, instead of long DOS commands. You Rock!

  5. AgoMago says:

    A simple solution….

    Open IIS 7 SnapIn
    Select the website you want enable to accept large file uploads.
    In the main window double click ‘Request filtering’
    once the window is opened you may see on top a list of tabs eg: file name extensions, rules, hidden segments and so on…
    regardless the tab you select, in the main window rightclick and select “Edit Feature Settings” and modify the “Maximum allowed content length (bytes)”

    Now you can upload files larger than 30 MB ….

  6. Pingback: Fixing IIS7 Maximum Upload Size | Twin Harbor Tech Blog

  7. Ramya says:

    AgoMago,

    It was really helpful. You saved my time!!!!!!!!!!!

    Ramya

  8. Pingback: Limit Upload File Size « Dako-Code

  9. Helder Conde says:

    Perfect solutions! Thanks so much for the helpfulness!

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>