Maximum request length exceeded exception
Asked Answered
A

2

21

I'm trying to upload a 20 meg file using the upload control and it's working fine on visual studio's built in webserver but once I publish it to the production server (which I have no access to) I keep getting the following error :

Server Error in '/' Application.
--------------------------------------------------------------------------------

Maximum request length exceeded. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: Maximum request length exceeded.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[HttpException (0x80004005): Maximum request length exceeded.]
   System.Web.HttpRequest.GetEntireRawContent() +11140903
   System.Web.HttpRequest.GetMultipartContent() +72
   System.Web.HttpRequest.FillInFormCollection() +245
   System.Web.HttpRequest.get_Form() +119
   System.Web.HttpRequest.get_HasForm() +11072199
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +124
   System.Web.UI.Page.DeterminePostBackMode() +83
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +270



--------------------------------------------------------------------------------

I've added the following to my system.web node so i don't know what the real issue is.

<httpRuntime executionTimeout="800" maxRequestLength="51200" />

Any direction on this would be very helpful.

Arkose answered 4/11, 2010 at 16:18 Comment(2)
you can take a look at here. it points the same solution but describes why. And this is the microsoft way: hereMoist
possible duplicate of Maximum request length exceededBelch
R
4

If config file change doesn't work, please try to update property httpRuntime executionTimeout="9200" maxRequestLength="200000"> directly from IIS.

For reference: maxRequestLength

Radley answered 11/7, 2018 at 5:40 Comment(0)
M
1

Although you have a 20Mb file, it is possible that encoding or other content on the page causes the 50Mb limit you have set to be exceeded. I recommend doubling your current setting.

There is also another web.config setting that could come into play: security request filtering maxAllowedContentLength.

This default to 30MB, but could be set differently in your environment.

The web.config entry would be something along the lines of:

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="1550000000" maxQueryString="16384" />
    <fileExtensions>
      <add fileExtension="." allowed="true" />
    </fileExtensions>
  </requestFiltering>
</security>
Melioration answered 8/5, 2018 at 1:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.