Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS7 - Webrequest failing with a 404.13 when the size of the request params exceeds 30mb

Tags:

I have a simple webmethod

[WebMethod] public int myWebMethod(string fileName, Byte[] fileContent) 

However, whenever I pass a byte array which is larger than 30mb, I get the error:

HTTP Error 404.13 - Not Found The request filtering module is configured to deny a request that exceeds the request content length.

My web.config is as follows:

<configuration>   <system.web>     <compilation debug="true" targetFramework="4.0"> </compilation>     <authentication mode="Windows" />     <httpRuntime useFullyQualifiedRedirectUrl="true"                  maxRequestLength="102400" requestLengthDiskThreshold="102400"     />     <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />   </system.web>   <system.webServer>     <security>       <requestFiltering>         <requestLimits maxAllowedContentLength="104857600"/>       </requestFiltering>     </security>   </system.webServer> </configuration> 

I've searched around, and the most common cause of this problem is the maxAllowedContentLength property being 30mb by default. However, I have set this to be 100mb, as well as the maxRequestLength property for httpRuntime.

I can't find a solution anywhere which isn't setting one of the properties I've already tried above. Is there something I have missed?

like image 418
John Avatar asked Feb 16 '12 12:02

John


1 Answers

You problem may lie in the fact that settings made in the web.config file may be superseded by corresponding settings present in both the applicationhost.config and machine.config files.

If you have access to these, check if the overrideModeDefault property of the corresponding sections are set to Allow, as in the following example:

machine.config

<requestFiltering overrideModeDefault="Allow">     <requestLimits maxAllowedContentLength="104857600"/>         </requestFiltering> 

AFAIK there is no way to override these settings if you don't have access to the corresponding configuration file.

You may find more information about system-wide configuration and settings override here, here and here - and a very similar case here.

like image 71
OnoSendai Avatar answered Sep 30 '22 02:09

OnoSendai