413 - Request Entity Too Large IIS and SSL

HansElsen picture HansElsen · Mar 11, 2015 · Viewed 19k times · Source

I get this error, the moment when I try to send a very large POST call to an Asp.net Web API over SSL.
I am aware of the fenomenon of renegotiation.
My uploadReadAheadSize is set to the max. (2147483647)

Can anybody tell me some options I should try?

Here is are request and response from Chrome dev console:

enter image description here

I have also tried the following commands without results:

C:\Windows\System32\inetsrv\appcmd.exe set config "Web API" -section:system.webServer/ServerRuntime /enabled:"1024000" /commit:apphost

C:\Windows\System32\inetsrv\appcmd.exe set config "Web API" -section:system.webServer/ServerRuntime /uploadReadAheadSize:"1024000" /commit:apphost

Answer

Trong Tran picture Trong Tran · Oct 7, 2015

IMPORTANT: this answer is available with HTTPS

  1. Goto configure directory

    C:/Windows/System32/inetsrv/config/

  2. Open applicationHost.config file in edit mode.

  3. Add this configure for your application

    Example: configure for 1 MB uploading

<location path="SiteName" overrideMode="Allow">
   <system.webServer>
     ......
      <serverRuntime enabled="true" uploadReadAheadSize="1024000" />     
     .....
   </system.webServer>
</location>
  1. Restart your site in the IIS