Thursday, August 5, 2010

403 error when you use an ASP request to upload a large (>200kb) file in IIS

Make sure the IIS web server is not restricting the size of ASP uploads. IIS 6 /IIS 7 have a limit of 200 KB for ASP requests in general and file uploads in particular.

Follow these steps in IIS 6

To remove this limitation in IIS 6 you need to edit the Metabase file, which can be found at c:\Windows\System32\Inetsrv\MetaBase.xml.

  1. Go to IIS and right click the server, select properties, and check the box "Allow changes to MetaBase configuration while IIS is running"

  1. if after this step the metabase file is still locked, try turning off IIS or even restarting the machine in safe mode; open the file in an editor; the variable AspMaxRequestEntityAllowed limits the number of bytes in the page request (by default 200KB); change the value to 1073741824 (unlimited) or to a limit of your choice

  1. Check whether the same variable shows up in other places in the file.
  2. do issreset

Or from the command prompt

  1. At a command prompt, type the following command, and then press ENTER:
  2. cd drive:\inetpub\adminscripts
  3. Note In this command to change folders, drive is a placeholder for the hard disk where IIS is installed.
  4. At a command prompt, type the following command, and then press ENTER:
  5. cscript adsutil.vbs set w3svc/ASPMaxRequestEntityAllowed size
  6. Note 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. At a command prompt, type the following command, and then press ENTER:
  7. iisreset

Follow these steps in IIS 7

  1. Open IIS Manager (inetmgr)
  2. Open "ASP"
  3. Go to Limit properties
  4. Edit maximum equesting Entity Body Limit - (say for eq 1073741824)
  5. do issreset

Or from the command prompt

C:\Windows\System32\inetsrv> appcmd set config /section:asp /maxRequestEntityAllowed:1073741824

No comments:

Post a Comment