AsyncFileUpload file size limit

Bao Qiang picture Bao Qiang · Aug 30, 2010 · Viewed 7.3k times · Source

When I was using AsyncFileUpload to upload 100KB image, I got no error message., but image not uploaded. I can upload 75KB image succssfully. I am using IIS 6.0.

    <cc1:AsyncFileUpload ID="afuImg" Width="400px" runat="server" 
UploaderStyle="Traditional" ThrobberID="Throbber2"  
    OnClientUploadError="uploadErrorImg" 
    OnClientUploadStarted="StartUploadImg" 
    OnClientUploadComplete="UploadCompleteImg" />

<httpRuntime maxRequestLength = "1024000" 
executionTimeout="54000" 
enableHeaderChecking ="false" />

Answer

kamui picture kamui · Dec 14, 2011

You can upload files with a combined size of up to 2GB, but it requires some modifications in your application configuration files.

  • set maxRequestLength in httpRuntime to 1024000000 (2GB max, you've done this)
  • Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET. The value of this setting is ignored in debug mode. The default in .NET Framework 2.0 is 110seconds. To enable large file uploads, which can take large periods of time, increase this property. See the following MSDN article: http://msdn2.microsoft.com/en-us/library/e1f13641.aspx.
  • Open the file C:\Windows\System32\inetsrv\config\applicationHost.config and find the line:

    <section name="requestFiltering" overrideModeDefault="Deny" />
    
  • Set the overrideModeDefault property to Allow.
  • The following attributes can be assigned in the element of the machine.config file. They must be set at the machine level, not the application level in web.config.
  • responseDeadlockInterval - Specifies the time interval, in the format HH:MM:SS, after which the process is restarted if there has not been a response during this interval. The default is 3 minutes. To allow very large uploads, you may have to increase this value.
  • responseRestartDeadlockInterval - Specifies the time, in the format HH:MM:SS, that must elapse after the last restart to cure a deadlock before the process is restarted to cure a deadlock again. To allow very large uploads, you may have to increase this value.
  • AspMaxRequestEntityAllowed - Sometimes when the application is hosted on Windows Server 2003, the above settings do not seem to have effect. In this case you must modify the IIS metadata file, particularly the AspMaxRequestEntityAllowed property. For more info see: http://www.telerik.com/support/kb/article/b454K-gth-b454T-cee.aspx

Finally Though I don't see it very often

  • If there is any third party network monitoring software you should ensure that it is properly configured to allow file uploads with the needed length and content.

Also there is another question on stackoverflow which goes into this How do I configure IIS to handle really large file uploads?

In the above question the answer https://stackoverflow.com/a/206796/728841 lists Urlscan being the problem it has it's own request entity length limit. The person was not aware that Urlscan was running on the server because it was a global ISAPI filter, not running on the individual website.

Note: to locate global ISAPI filters, right click on the Web Sites folder in IIS Admin and click Properties, then on the ISAPI Filters tab.