ASP .Net File Upload Maximum request length exceeded error
Asked Answered
G

2

8

I have a simple ASP .Net file upload control on a page. I have following web.config settings

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

    <system.web>
      <httpRuntime maxRequestLength="524288" executionTimeout="120000" />
    </system.web>

I am using IIS 7.5 on my dev box and IIS 7 on web server.

If i upload file of size 7MB, it works fine.

But when i upload file which is 10MB, it will throw following exception

I have a simple ASP .Net file upload control on a page. I have following web.config settings

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

Stack Trace:     

[HttpException (0x80004005): Maximum request length exceeded.]
   System.Web.HttpRequest.GetEntireRawContent() +8772610
   System.Web.HttpRequest.GetMultipartContent() +62
   System.Web.HttpRequest.FillInFormCollection() +168
   System.Web.HttpRequest.get_Form() +68
   System.Web.TraceContext.InitRequest() +910
   System.Web.TraceContext.VerifyStart() +143
   System.Web.HttpApplication.AssignContext(HttpContext context) +118
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +464

Any help would be highly appreciated. I know this question has been asked many times, but none of those solution worked for me.

We are using Sitecore Content Management System.

Genitive answered 1/10, 2012 at 20:11 Comment(2)
You should check the file size with if control. Otherwise you will get an error or you will set the error page for it in web.config.Krug
I do have check for file size, but i get this error even before page load on post back. I tried to put break point in Global.asax file on begin request, but it is failing even before that.Genitive
G
4

I finally got it resolved. As we are using Sitecore, we have page as an item on content tree at specific path. Now we also have some old pages which resides on file system. These pages which resides on file system has their own local web.config file which has limited maxrequest length. This setting was creating issues while uploading large files.

Thanks all of you for your help.

Genitive answered 23/10, 2012 at 13:19 Comment(0)
A
6

Your maxRequestLength is set for 512 MB which is excessively large. Try setting it for 12MB instead.

If it's IIS that is choking, try setting it as a non-application level; create a Web.Config in the file folder instead.

More information here:

http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx

Amidst answered 1/10, 2012 at 20:22 Comment(2)
I have set maxRequestLength to 524288 KiloBytes which is 512MB. Is there any problem?Genitive
My bad. However, set it for something smaller like 12 MB and see if that fixes it.Amidst
G
4

I finally got it resolved. As we are using Sitecore, we have page as an item on content tree at specific path. Now we also have some old pages which resides on file system. These pages which resides on file system has their own local web.config file which has limited maxrequest length. This setting was creating issues while uploading large files.

Thanks all of you for your help.

Genitive answered 23/10, 2012 at 13:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.