HTTP 413 Request Entity too Large – Can’t upload large files using IIS6


Well, here’s a new one I ran across recently.  My customer was trying to upload some files using Coldfusion by doing a simple post and was getting a HTTP 413 response when the files were larger than 128K.  IIS6 uses a new metabase property called UploadReadAheadSize when passing data to an ISAPI extension.  In this particular case the customer was using CAC (client access certs) and so the SSL preload was using this property to determine the maximum buffer size for the incoming request.  The default size for this buffer is 48k, which was added to prevent anonymous DOS attacks by uploading very large garbage files. 

The fix is simply to up the size of the UploadReadAheadSize metabase property.  One thing I would like to point out is an error in the technet documentation that explains how to do this (link below).  The following link instructs you to set the size as follows:

cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 200

Which should read:

cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 204800

The metabase setting is represented in bytes, not KB as the technet article would suggest.  You can change this setting up to 4GB although you probably wouldn’t want to do so unless you had a compelling business need.  Of course a site that required authentication would be an effective way of limiting the chances of DoS, so if you do need to up this limit, you should consider requiring client authentication to connect. 

Client cannot renegotiate request and returns an HTTP 413 error (IIS 6.0)
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/7e0d74d3-ca01-4d36-8ac7-6b2ca03fd383.mspx?mfr=true 

Other useful related links:

HTTP/1.1 200 OK

Comments (23)

  1. kiralan says:

    Jiruss, thanks very much. Your tip worked perfectly!

  2. Gaspare says:

    Hi

    I tried the above but I still encounter HTTP 413

  3. Gaspare says:

    I have set up SSO with IIS and tomcat.

    tripled the value of uploadreadaheadsize

    Also set SSLAlwaysNegoClientCert to true

    Still encountered HTTP 413

  4. Kira says:

    since its still present. can  we just "REPLACE" the message to atleast have a more user friendly message like "Server is currently busy, Please try again in a few minutes." … I tried try catch in server side code and it didnt catch it… so any ideas how to catch this ???

  5. profi says:

    PLease remember:

    YOu have to replace the "1" with your Website-ID!!

    w3svc/1/uploadreadaheadsize 204800

    w3svc/2/uploadreadaheadsize 204800

    w3svc/3/uploadreadaheadsize 204800

    w3svc/181/uploadreadaheadsize 204800

    etc

  6. Anonymous geek says:

    For IIS7, please see blogs.iis.net/…/iis7-tweet-1-setting-uploadreadaheadsize.aspx

    adsutil.vbs is no longer supported by IIS7, it seems

  7. Md Noor says:

    Thanks Jimmie , It solved my problem in case of uploading files via HTTPS (I got this particular issues for HTTPS) After increasing uploadreadAheadSize property is started working .

    Thanks a lot ……………………

  8. isaac says:

    i am trying to fill in a form online but when i send it i only receive the following message.Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 413

  9. Issac,

    Is this your web site or are you using a 3rd party site and getting this error. Unless you are the owner/admin of the site, there is nothing you can do except contact the site tech support for help. If this is your own site, then look at the setting I mentioned above and also try setting the maxrequestlength property to a larger value. For how, please refer to this:

    msdn2.microsoft.com/…/e1f13641.aspx

  10. Isaac says:

    Jimmie this is not my website but Emirates group website and there are application i need to fill and submit the online application.

  11. Issac,

    You will need to contact the site owner/support for this. The only thing you can do on the client side is post less data.

    Regards

  12. Editor says:

    The correct link for UploadReadAheadSize Metabase Property is technet.microsoft.com/…/cc728324(v=WS.10).aspx

  13. Jimmie Ru - MSFT says:

    I have corrected the links Editor. Thanks.

  14. Siva Senthil says:

    Is this article applicable for IIS 7. I am recieving similar errors in IIS 7.

    The error text is – "The remote server returned an unexpected response: (413) Request Entity Too Large."

  15. Jimmie Ru - MSFT says:

    Hello Siva,

    This applies to IIS7/7.5 as well. Here are the instructions.

    IIS 7+ :

    Launch "Internet Information Services (IIS) Manager"

    Expand the Server field

    Expand Sites

    Select the site you want to make the modification for.

    In the Features section, double click "Configuration Editor"

    Under "Section" select: system.webServer -> serverRuntime

    Modify the "uploadReadAheadSize" section (This value should be in Bytes)

    Click Apply

    Do an IIS Reset

  16. Foxinonapoli says:

    Da tutte le note che ho letto, non sono riuscito a capire cosa dovrei fare e/o dove operare per superare il seguente messaggio di errore : "Request  Entity  Too  Large" improvvisamente apparso e che non mi fa aprire una pagina di un sito

  17. This solved our problem. What a pain in the ... says:

    No one admits to changing anything but we had upload routine from hundreds of sites start failing.  This error started popping up after we did testing with certificate for SSL.  After finding Jimmie Ru reference to the setting checked and it was 49451.  Obviously not large enough for our needs so modified and everything works again.

  18. superna says:

    I spent whole day trying to fix this issue and finally run into the Jimmie Ru's solution. That just did a magic. Thanks for posting it Jimmie, it saved my day.

  19. Raj says:

    Jimmie – You are my hero of the day! Thanks man

  20. Hitesh says:

    I have increased the uploadReadaheadsize value upto 104857600 bytes but still encountering the same error i.e. Request Entity too large. I am also using a web service which is used to upload the documents. Please help

  21. Harry says:

    Huge problem with 413 message when trying to upload a 1.4Mb Joomla extension. Tried all sorts of recommended fixes to no avail. Turned out my VPN was the culprit. Turned it off and the file uploaded and installed without a problem.

  22. Foxinonapoli says:

    If it was nginx then follow this tutorial – atulhost.com/fix-nginx-error-413-request-entity-too-large