Friday, October 24, 2008

Flash uploading large files to ASP.NET: HTTP 500 Error

If you are having trouble uploading large files via flash or standard asp.net form its probably because there is a max request length set in the machine.config file. Max request length by default is set to 4MB.

When exceeding the max request length you get a HTTP 500 error code.
If you check the Application Event viewer on the server side you might see errors such as this:

Event code: 3004
Event message: Post size exceeded allowed limits.
Event time: 10/24/2008 5:11:39 PM
Event time (UTC): 10/24/2008 10:11:39 PM
Event ID: 640ae5c3a03349b18112b5289fd09989
Event sequence: 12
Event occurrence: 3
Event detail code: 0




To solve this problem override your web.config with the following configuration element.

Also update the executionTimeout to allow more time before it shuts down the request.



<configuration>

<system.web>

<httpRuntime maxRequestLength="11000" executionTimeout="60" />

<!-- 50MB max request size-->




More information can be found at the MSDN site

http://msdn.microsoft.com/en-us/library/e1f13641(VS.71).aspx

1 comment: