Maximum request length exceeded despite set configuration values

I am having problems uploading files larger than 4 MB in storage using the MVC application I'm working on. I added the necessary code to web.config as shown below:

Inside system.web

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

Inside system.webserver

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

I rebuilt my web project and my project in azure mode, but I still get the maximum request length exceeding the error. Any ideas what could be causing this? The stack trace is as follows:

[HttpException (0x80004005): The maximum request length has been exceeded.] System.Web.HttpRequest.GetEntireRawContent () +12603644 System.Web.HttpRequest.GetMultipartContent () +221 System.Web.HttpRequest.FillInFormHollection () .EnsureForm () +110 System.Web.HttpRequest.get_Form () +16 System.IdentityModel.Services.WSFederationAuthenticationModule.IsSignInResponse (HttpRequestBase request) +32 System.IdentityModel.Services.WSFicationRestEmentTementuteentututentateututateututentateututentututateututentututateututateututentateututentututentoututentututentutoutentutentateututentututentate System.IdentityModel.Services.WSFederationAuthenticationModule.OnAuthenticateRequest (sender of the object, Arguments of EventArgs) +152 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () +80 System.Web.epecExpecExpececpecpt completed synchronously) +165

+4
source share
1 answer

I had a similar problem, the problem was stupid

There was already an httpRuntime tag in my web.config with the targetFramework attribute specified.

I created a second httpRuntime tag instead of adding maxRequestLength to an existing httpRuntime tag. Therefore, my value was ignored.

+6
source

Source: https://habr.com/ru/post/1495902/


All Articles