Windows Server 2003 (IIS 6.0):

When you use an Active Server Pages (ASP) request to upload a large file to a computer where Microsoft IIS 5.0, 5.1, or 6.0 is installed, the upload may fail.

This issue occurs if a Content-Length header is present & if the Content-Length header specifies an amount of data that is larger than the value of the AspMaxRequestEntityAllowed property in the IIS metabase. The default value for the AspMaxRequestEntityAllowed property is 204,800 bytes [200Kb].

To increase this value, modify the value in the AspMaxRequestEntityAllowed property to set the maximum number of bytes that are permitted in the entity body of an ASP request. To do this, follow these steps:

Editing the Metabase.xml directly [Not Recommended]:

Warning : If you edit the metabase.xml incorrectly, you can cause serious problems that may require you to reinstall any product that uses the metabase. It's advised to backup the metabase before editing it..

  1. Stop the web server using iisreset /stop
  2. Opening the Metabase file (%systemroot$/system32/inetsrv/metabase.xml) in a text editor [Notepad/Wordpad].
  3. Search for the term ASPMaxRequestEntityAllowed node.
  4. Changing it's value to the desired/required one [104857600 Bytes for 100MB].


Using the inbuilt/shipped scripts [Recommended method]:

You can run the following from a command prompt while in the C:\Inetpub\AdminScripts directory instead of editing the Metabase.xml file directly as mentioned in above method.

1. At a command prompt, type the following command, & then press ENTER:
cd C:
cd C:\Inetpub\AdminScripts
2. At a command prompt, type the following command, & then press ENTER to check the current upload limit:

cscript adsutil.vbs get w3svc/ASPMaxRequestEntityAllowed

C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/ASPMaxRequestEntityAllowed

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

ASPMaxRequestEntityAllowed : (INTEGER) 204800
It displays the current/present value that is set to 204800 ie: 200KB.

3. Now to change the value to any higher one, run the following command:

cscript adsutil.vbs set w3svc/ASPMaxRequestEntityAllowed size

In this command, size is a placeholder for the largest file size upload that you want to allow. The maximum value is 1,073,741,824 bytes. Set this value to the lowest possible value that allows for the functionality that you want.

To change the value to 100MB, run the following command:cscript adsutil.vbs set w3svc/AspMaxRequestEntityAllowed 104857600
C:\Inetpub\AdminScripts>cscript adsutil.vbs set w3svc/AspMaxRequestEntityAllowed 104857600
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

AspMaxRequestEntityAllowed : (INTEGER) 104857600
4. Run iisreset /restart to restart the web services & for the changes to come into effect.

You can confirm the changes by checking the ASPMaxRequestEntityAllowed using the GET command [as in step 2]:
C:\Inetpub\AdminScripts>cscript adsutil.vbs get w3svc/ASPMaxRequestEntityAllowed
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

ASPMaxRequestEntityAllowed : (INTEGER) 104857600
The example above updates the metabase.xml file & sets the maximum uploadable value to 100MB. You're done

More detailed info on this: The AspMaxRequestEntityAllowed property specifies the maximum number of bytes that are permitted in the entity body of an ASP request. If a Content-Length header is present & if the Content-Length header specifies an amount of data that is larger than the value of the AspMaxRequestEntityAllowed property, IIS returns a 403 error response. The AspMaxRequestEntityAllowed property applies only to PUT requests & to POST requests. The AspMaxRequestEntityAllowed property does not apply to GET requests. Because this metabase property applies only to ASP, other Internet Server API (ISAPI) extensions are not affected.

The AspMaxRequestEntityAllowed property is related in function to the MaxRequestEntityAllowed property. However, the AspMaxRequestEntityAllowed property is specific to ASP requests. You can set the MaxRequestEntityAllowed property to 1 megabyte (MB) at the World Wide Web Publishing Service (WWW Service) level. Then, you can set the AspMaxRequestEntityAllowed property to a smaller value if you know that your specific ASP applications handle a smaller amount of data.


Windows Vista or Windows Server 2008 (IIS 7.0):

With Windows Vista & Windows Server 2008, the way is a bit different. To achieve the same setting, it can now be done via the IIS Administrative tool. To change do the following:

* Open IIS Manager from the Administrative Tools.
* Select the Server from the tree structure on the left hand side
* Double click on ASP in the right pane.

* You will see a list of properties, Expand the Limits Properties & you will see Maximum Request Entity Body Limit. Set the value here in bytes to the upload limit you wish/require.

* Click Apply & you're done

There is a similar limit imposed in all flavours of ASP.net. This can be configured in the machine.config file of the machine or in the web.config for the application. Adding the following under the <system.web> tag in the will increase the ASP.net maximum upload to 10MB in this example.
<system.web>
<httpRuntime maxRequestLength="102400" />
</system.web>
Happy uploading..