{"id":2742,"date":"2014-02-09T14:34:31","date_gmt":"2014-02-09T06:34:31","guid":{"rendered":"http:\/\/rmohan.com\/?p=2742"},"modified":"2014-02-09T14:58:14","modified_gmt":"2014-02-09T06:58:14","slug":"https-413","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=2742","title":{"rendered":"HTTPS 413"},"content":{"rendered":"<h3 itemprop=\"name\">IIS 7.5 &#8211; uploadReadAheadSize<\/h3>\n<div><\/div>\n<div id=\"post-body-5108972285819804937\" itemprop=\"description articleBody\">A developer recently reported a problem that when a customer attempted to upload an attachment, they would sometime receive the error:The page was not displayed because the request entity is too large.In our case it did not include an error number, but it will sometimes include the error number:<\/p>\n<p>HTTPS 413<\/p>\n<p>The fix for us is listed below:<\/p>\n<p>How to set the uploadReadAheadSize in IIS 7.5<\/p>\n<ol>\n<li>Launch &#8220;Internet Information Services (IIS) Manager&#8221;<\/li>\n<li>Expand the Server field<\/li>\n<li>Expand Sites<\/li>\n<li>Select the site you want to make the modification for.<\/li>\n<li>In the Features section, double click &#8220;Configuration Editor&#8221;<\/li>\n<li>Under &#8220;Section&#8221; select: system.webServer&gt;serverRuntime<\/li>\n<li>Modify the &#8220;uploadReadAheadSize&#8221; section<\/li>\n<li>Click Apply<\/li>\n<\/ol>\n<h2>1. uploadReadAheadSize<\/h2>\n<p>In the second scenario, the error occurred because of the size of the page, it is very large and it caused to request entry body become larger when you submitting the page.<a href=\"http:\/\/www.microsoft.com\/technet\/prodtechnol\/WindowsServer2003\/Library\/IIS\/7e0d74d3-ca01-4d36-8ac7-6b2ca03fd383.mspx?mfr=true\">http:\/\/www.microsoft.com\/technet\/prodtechnol\/WindowsServer2003\/Library\/IIS\/7e0d74d3-ca01-4d36-8ac7-6b2ca03fd383.mspx?mfr=true<\/a><\/p>\n<p>Basically, what happens is if you have a website with SSL and &#8220;Accept Client Certificates&#8221; enabled HTTP requests are limited to the UploadReadAheadSize of the site. To resolve this, you have to increase the\u00a0<code>UploadReadAheadSize<\/code>. (Default size 48kb)<\/p>\n<div id=\"premain0\"><img loading=\"lazy\" decoding=\"async\" id=\"preimg0\" alt=\"\" src=\"http:\/\/www.codeproject.com\/images\/minus.gif\" width=\"9\" height=\"9\" \/>\u00a0Collapse\u00a0|\u00a0<a href=\"http:\/\/www.codeproject.com\/Articles\/521725\/413-Request-Entity-Too-Large#\">Copy Code<\/a><\/div>\n<pre id=\"pre0\" lang=\"text\">appcmd.exe set config -section:system.webserver\/serverruntime \/uploadreadaheadsize: 1048576 \/commit:apphost<\/pre>\n<h2>2. maxReceivedMessageSize<\/h2>\n<p>WCF by default limits messages to 64KB to avoid DOS attack with large message. By default, it sends byte[] as base64 encoded string and it increases the size of the message (33% increase in size). There for if the uploaded file size is ~larger than 48KB then it raises the above error. (48KB * 1.33 = ~64KB) (NB. you can use MTOM \u2013 Message Transmission Optimization Mechanize to optimize the message)<\/p>\n<p>By modifying the &#8220;<code>maxReceivedMessageSize<\/code>&#8221; in the Web.config file to accept large messages, you can solve this issue.<\/p>\n<div id=\"premain1\"><img loading=\"lazy\" decoding=\"async\" id=\"preimg1\" alt=\"\" src=\"http:\/\/www.codeproject.com\/images\/minus.gif\" width=\"9\" height=\"9\" \/>\u00a0Collapse\u00a0|\u00a0<a href=\"http:\/\/www.codeproject.com\/Articles\/521725\/413-Request-Entity-Too-Large#\">Copy Code<\/a><\/div>\n<pre id=\"pre1\" lang=\"xml\">&lt;system.serviceModel&gt;\r\n  &lt;bindings&gt;\r\n    &lt;basicHttpBinding&gt;\r\n      &lt;binding maxReceivedMessageSize=\"10485760\"&gt;\r\n        &lt;readerQuotas ... \/&gt;\r\n      &lt;\/binding&gt;\r\n    &lt;\/basicHttpBinding&gt;\r\n  &lt;\/bindings&gt;  \r\n&lt;\/system.serviceModel&gt;<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>IIS 7.5 &#8211; uploadReadAheadSize A developer recently reported a problem that when a customer attempted to upload an attachment, they would sometime receive the error:The page was not displayed because the request entity is too large.In our case it did not include an error number, but it will sometimes include the error number:<\/p>\n<p>HTTPS 413<\/p>\n<p> [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2742"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2742"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2742\/revisions"}],"predecessor-version":[{"id":2756,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2742\/revisions\/2756"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}