Search code examples
c#asp.net-mvcruntime-error

Resolving maximum request length exeeded error


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?


Solution

  • 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 :)