locked
Request entity too large RRS feed

  • Question

  • User1510859543 posted

    I have an asp.net application to upload photos by selecting or via immediate camera shot. The upload is being done from the browser using jquery ajax and it works great sometimes. However, when I try to upload a very large file or do an upload via smartphone camera I am getting an error "The page was not displayed because the request entity is too large.".  I made the change below to the app web.config file in system.webserver section but it still gives the error. Is there somewhere else that I need to make a change?

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

    I even tried adding another zero at the end.

    Wednesday, March 10, 2021 5:01 PM

Answers

  • User-1330468790 posted

    Hi dlchase.

     

    First of all, you should check the actual size of the file. If it is 50 MB, which is less than 80000000 bytes, then you should consider checking maxRequestLength attribute of the "httpruntime" node (under the <system.web> node).

    In short, the maxRequestLength indicates the maximum file upload size supported by ASP.NET while the maxAllowedContentLength specifies the maximum length of content in a request supported by IIS.

    Therefore, we need to set both maxRequestLength and maxAllowedContentLength values if we want to upload large files.

    You could refer to this link for more details.

    Which gets priority, maxRequestLength or maxAllowedContentLength?

     

    Hope helps.

    Best regards,

    Sean

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 11, 2021 3:41 AM

All replies

  • User-1330468790 posted

    Hi dlchase.

     

    First of all, you should check the actual size of the file. If it is 50 MB, which is less than 80000000 bytes, then you should consider checking maxRequestLength attribute of the "httpruntime" node (under the <system.web> node).

    In short, the maxRequestLength indicates the maximum file upload size supported by ASP.NET while the maxAllowedContentLength specifies the maximum length of content in a request supported by IIS.

    Therefore, we need to set both maxRequestLength and maxAllowedContentLength values if we want to upload large files.

    You could refer to this link for more details.

    Which gets priority, maxRequestLength or maxAllowedContentLength?

     

    Hope helps.

    Best regards,

    Sean

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 11, 2021 3:41 AM
  • User1510859543 posted

    Thanks. With more checking I found that because the site uses SSL I had to set the "UploadReadAheadSize" setting in system.webServer/serverRuntime 

    I set it to 1048576 and the larger photos direct from camera worked.

    Thursday, March 11, 2021 3:32 PM