Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum request length exceeded despite config values being set

I am having some issues when uploaded files of greater than 4MB to blob storage using an MVC application that I am working on. I have added the necessary code in the web.config as shown below:

Within system.web

<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />

Within system.webserver

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824" />
  </requestFiltering>
</security>

I have rebuilt my web project and my azure project but I am still getting the maximum request length exceeded error. Any ideas what might be causing this? Stack trace is as follows:

[HttpException (0x80004005): Maximum request length exceeded.] System.Web.HttpRequest.GetEntireRawContent() +12603644 System.Web.HttpRequest.GetMultipartContent() +221 System.Web.HttpRequest.FillInFormCollection() +357 System.Web.HttpRequest.EnsureForm() +110 System.Web.HttpRequest.get_Form() +16 System.IdentityModel.Services.WSFederationAuthenticationModule.IsSignInResponse(HttpRequestBase request) +32 System.IdentityModel.Services.WSFederationAuthenticationModule.CanReadSignInResponse(HttpRequestBase request, Boolean onPage) +129 System.IdentityModel.Services.WSFederationAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs args) +152 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

like image 337
Jay Avatar asked Aug 08 '13 08:08

Jay


1 Answers

I had a similar problem, the problem was silly

In my web.config there were already a httpRuntime tag with targetFramework attribute specified.

I created a second httpRuntime tag instead of add maxRequestLength in the already present httpRuntime tag. So my value was ignored.

like image 129
binard Avatar answered Sep 27 '22 23:09

binard