Home > Mobile >  Resolving maximum request length exeeded error
Resolving maximum request length exeeded error

Time:11-18

I am trying to upload files that are 6mb in size. The web config is set as follows:

  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483648" />
      </requestFiltering>
    </security>
  </system.webServer>

I keep getting this error : Maximum request length exceeded.

Is there something that I am missing?

CodePudding user response:

In machine.config 4MB is set as default, but you can override it in you web.config file.

Try adding this:

<configuration>  
    <system.web>
       <httpRuntime executionTimeout="240" maxRequestLength="20480" />
    </system.web> 
</configuration>

CodePudding user response:

Ok so basically I figured that in my case even when editing the webconfig file and its maximum content length, it doesn't really work if you do not set your IIS settings correctly.

To do this:

  1. go on the specific website you want to edit in IIS

  2. select configuration Editor

  3. set the section to - system.web/httpRuntime

  4. set the MaxRequestLength in kilobytes. You can use this tool to make the conversion from kb to mb and vice versa easier https://www.unitconverters.net/data-storage/kb-to-mb.htm

  5. Don't forget to click on apply in the right tab in IIS.

  6. Retry and hope for the best :)

CodePudding user response:

Please set 'MaxRequestLength' property in httpRuntime section of web.config to a higher value. Please note that the unit for this property value is KB. The default is 4096 KB = 4 MB

https://docs.microsoft.com/en-us/dotnet/api/system.web.configuration.httpruntimesection.maxrequestlength?view=netframework-4.8

  • Related