52

I'm getting the following error while redirecting one page to another web page:

"the page was not displayed because the request entity is too large.".

The page from which I'm redirecting to another page contains a huge amount of data, so basically I know the cause of the issue.

However, I'm looking out for a working solution for this. Secondly, when I researched this issue I found such kind of problem generates when any large file gets uploaded.

But I'm not uploading any large file, its just the page itself contains large data. Prompt solution will be appreciated.

4
  • I have the same issue with my users. No upload functionality, but periodically they get the error. It might have something to do with IIS and they stay on a certain page too long, walk away from their computers, then come back hours later and click a link. I can't duplicate the error. Sep 17, 2014 at 19:36
  • @Shilpa, do you got the solution ? if yes, please share it with me. Thank you.
    – kevin
    Jan 19, 2015 at 10:08
  • 2
    @kevin, please try by adding below statement in <system.web> tag in your web.config file- <httpRuntime executionTimeout="999999" maxRequestLength="1024000" requestValidationMode="2.0" /> Jan 19, 2015 at 10:20
  • Oh it doesn't work for me. Anyway thank you.
    – kevin
    Jan 19, 2015 at 10:52

7 Answers 7

57

I think this will fix the issue if you have SSL enabled:

Setting uploadReadAheadSize in applicationHost.config file on IIS7.5 would resolve your issue in both cases. You can modify this value directly in applicationhost.config.

  1. Select the site under Default Web Site

  2. Select Configuration Editor

  3. Within Section Dropdown, select "system.webServer/serverRuntime"

  4. Enter a higher value for "uploadReadAheadSize" such as 1048576 bytes. Default is 49152 bytes.

During client renegotiation process, the request entity body must be preloaded using SSL preload. SSL preload will use the value of the UploadReadAheadSize metabase property, which is used for ISAPI extensions

Reference.

5
  • 1
    I just confirmed that this was the fix! After a postback with .NET webforms in IIS7, if the page idle for 90 seconds and then I did another postback I would get the request entity is too large error. Hopefully this will help someone else. whew! Sep 18, 2014 at 21:31
  • is it this one ? <serverRuntime uploadReadAheadSize="524288000"/>
    – kevin
    Jan 19, 2015 at 11:03
  • yes, that would be the web.config entry. I configured through IIS. Feb 10, 2015 at 21:00
  • This helped a lot but the link provided seems to be broken. :( Apr 3, 2018 at 23:39
  • fixed the link now
    – Ram
    Mar 3, 2020 at 3:56
33

I got it working by doing the following

  1. Go to IIS.
  2. Click on the server name
  3. In the features (icons), chose the configuration editor.
  4. Click on the dropdowns on the top with Settings
  5. Traverse the path system.webServer -> security -> requestFiltering -> maxAllowedContentLength and set it to 334217728. (Then hit enter and then apply on the top right).

You can also restart the webserver for good measure. After that I could upload my 150k database to phpymyadmin.

I also set post_max size to 8000 in php.ini in programs/PHP/phpversion/php.ini

It may be overkill for the sizes but it gets the job done when you've got big files.

2
  • The error stopped after following your fix. Thanks. Nov 24, 2020 at 19:07
  • tks, making this works for me
    – Mac135
    Jul 21, 2022 at 15:04
19

For me, uploadReadAheadSize did not fix my issue.

I changed both of these settings in my asp.net web.config and finally the file uploaded for me:

<system.web>
  <system.webServer
<httpRuntime executionTimeout="999999" maxRequestLength="20000" requestValidationMode="2.0" /> <!-- 20 MB -->
</system.web>

  <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="20500000" />  <!-- 20.5 MB - making it match maxRequestLength to fix issue with uploading 20mb file -->
      </requestFiltering>
   </security>   
  </system.webServer>
2
  • 3
    The second one helped Mar 16, 2020 at 9:39
  • 2
    The second one actually fixed the problem for me as well Jun 14, 2021 at 17:21
4

Another possible cause is an Authentication setting. Within IIS7,

  1. Select the site under Default Web Site

  2. Select Authentication

  3. Select Windows Authentication and enable. Disable all others.

  4. While Windows Authentication is still selected, click on Advanced Settings in the Actions pane.

  5. Make sure Extended Protection is on Accept and check the Enable Kernel-mode authentication

4

I had the same error and the above fix did not work. I was only on HTTP (localhost) However this fixed the 413 error

Set-WebConfigurationProperty -filter /system.webserver/security/requestfiltering/requestLimits -name maxAllowedContentLength -value 134217728
1
  • It seems that the value could be 334217728 as mentioned in this answer provided above Jun 1, 2022 at 6:27
2

I did the above but still had no joy.

What fixed the problem for me was also upping the request limits: - Select site in IIS manager - Click "Edit feature settings" from right hand menu - Insert 200000000 for "Maximum allowed content length"

1

In my case, the error occurred when downloading a file.

The reason was, that I had a code that explicitely sends an HTTP 413 to the client in an (erroneous) case.

(See here for details).

So be aware of the fact that setting an HTTP response code 413 in your code (or in a library that you are using) also can generate the OP's error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.