John
John

Reputation: 1522

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

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?

Upvotes: 22

Views: 20796

Answers (2)

Fred_W
Fred_W

Reputation: 12

This is pretty old. But I have the same problem today. To fix this, you need to make the necessary setting changes in web.config, then deploy to the web server. The important part is that you need to re-deploy your application to the web server. By doing so, the IIS settings are updated for you. Depending on how you do your deployment, you may need to delete your web application from the web server first, then deploy again. Updating web.config in place won't fix the problem. Hope this helps others with the same problem.

Upvotes: -2

OnoSendai
OnoSendai

Reputation: 3970

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.

Upvotes: 12

Related Questions