Blog Post

IIS Support Blog
1 MIN READ

Solution for “Request Entity Too Large” error

Nedim's avatar
Nedim
Former Employee
Apr 29, 2019

IIS has a limit for the size of the files users can upload to an application. If the file size exceeds the limit, the application will throw “Error in HTTP request, received HTTP status 413 (Request Entity Too Large)” error.

 

The default file upload size is 49 KB (49152 bytes). The application records the log below if user tries to upload a file that is bigger than this size.

 

 

Why this issue occurs for SSL sites? The reason is that the request body must be preloaded during the SSL handshake process.

 

Solution

The quickest solution is to increase the upload size limit. IIS uses uploadReadAheadSize parameter in applicationHost.config and web.config files to control this limit.

 

uploadReadAheadSize
Optional uint attribute.
Specifies the number of bytes that a Web server will read into a buffer and pass to an ISAPI extension or module. This occurs once per client request. The ISAPI extension or module receives any additional data directly from the client. The value must be between 0 and 2147483647.
The default value is 49152.

Server Runtime

 

Steps to change the value of this parameter:

  1. Open IIS Manager
  2. Select the site
  3. Double click “Configuration Editor”
  4. Select system.webServer and then serverRuntime
  5. Modify the uploadReadAheadSize value
  6. Click “Apply”

 

 

You may also want to change maxRequestEntityAllowed parameter. It specifies the maximum number of bytes allowed in the request body.

 

Note: In another case, the recommendations above didn't work to solve 413 error. Please check this post for more information

Updated May 25, 2021
Version 2.0

13 Comments

  • RayCuadra71's avatar
    RayCuadra71
    Copper Contributor

    Hi I'm also encountering this in our On-premise instance of DevOps and this is the first time we are encountering such issues.  In our previous version of TFS 2017 this was never an issue. Was there a big change in DevOps 2019 using SSL?

  • Nedim's avatar
    Nedim
    Former Employee

    JWANicholls2807 Thanks for checking out the post! Can you please check what the substatus code in IIS logs? Additionally, please set up Failed Tracing Logs to see which module is throwing the error

  • JWANicholls2807's avatar
    JWANicholls2807
    Copper Contributor

    Did the above and I'm still seeing 413 responses from my server:(

    Trying to post back a RadSpreadheet over 50KB on an SSL connection...

    I set the uploadReadAheadSize to 100MB, the actual file is around 100KB so you wiuld think it would be fine right... rebooted the server just to be sure...

    No impact!