pearcewg
pearcewg

Reputation: 9613

asp.net - post file gives 404 page result even though posted file is well under maxRequestLength

I have a page on my ASP.NET site which uploads files. I have attempted to tweak the web.config file to allow for larger uploads. In my web.config, I set:

<httpRuntime maxRequestLength="2097152" executionTimeout="3600" />

On my page, when I attempt to upload smaller files, no issue...even at 25MB. However, when I attempt to upload a 50MB file, I still get a 404 error page.

NOTE: I have a flash control on a different page which can upload almost 2gb with no issues, using this same web.config setting. Same result on different PCs, same result when posted to different web servers. My web server is Windows Server 2008 R2.

Any ideas of the cause? Why would flash be ok, but plain jane upload control have this problem?

Upvotes: 13

Views: 7057

Answers (2)

pearcewg
pearcewg

Reputation: 9613

I found the answer. Windows Server 2008 R2 is using IIS7 (of course), and in IIS7, you have to set the following in your web.config file (in my example to increase the limit to 2gb):

 <system.webserver>
   <security>
     <requestFiltering>
       <requestLimits maxAllowedContentLength="2147483648" />
     </requestFiltering>
   </security>
 <system.webserver>

This worked, when everything else didn't. IIS7 by default limits uploads to 30mb unless this override is set.

Upvotes: 23

Chaim Zonnenberg
Chaim Zonnenberg

Reputation: 1823

The executionTimeout applies only if the debug attribute in the compilation element is False. (see also http://msdn.microsoft.com/en-us/library/e1f13641.aspx)

So try it when starting your application in Release config.

Upvotes: 1

Related Questions