Enterprise
Edition

 

Large Uploads in ASP.NET



The HttpModule

FileUpEE's HttpModule intercepts selected requests to overcome ASP.NET's inefficient memory utilization and to allow accurate progress indication. The HttpModule intercepts an upload request, reads all the data, and writes it to a temp file chunk by chunk, before forwarding the request to ASP.NET.

For performance reasons, the HttpModule will not intercept all ASP.NET requests. It will intercept ASP.NET requests for files with the extension .uplx. Files with the extension .aspx will not be processed by the filter, and will be sent directly to ASP.NET. This prevents burdening the server with unnecessary use of the HttpModule. So, to use the HttpModule, name your ASP.NET scripts FileName.uplx.

With the FileUpEE registry key FilterAspDotNetFlagExtension, you can change the file extension used to signal the HttpModule in ASP.NET (.uplx) to a different extension of up to seven characters. By using a file extension other than .uplx you can hide your web server implementation (Windows/IIS) from potential hackers.

If you install the ASP.NET version of FileUpEE, the automatic installation package will install the HttpModule for FileUpEE's samples, and create the script mappings for the .uplx extension. See Installing the HttpModule for instructions on installing the HttpModule at the application level or in the Global Assembly Cache.

Unlimited Upload Size on the Client
While FileUpEE can process uploads of any size, most browsers support uploads of up to 2 GB. Larger uploads must be generated by a client-side control that can handle very large transfers, such as SoftArtisans XFileEE.
The HttpModule and Progress Indication
Under ASP.NET, FileUpEE's progress indicator is handled by the HttpModule. To display accurate progress indication, upload to a file with the .uplx extension, and ensure that the ProgressIndicator registry key is set to 1.

Top


FileUpEE Registry Keys

FileUpEE includes several registry keys that allow you to optimize the performance of large uploads. For more information see, FileUpEE Registry Keys.

Top


ConnectionTimeout

IIS's Connection Timeout property sets a time in seconds at which the server will disconnect an inactive connection. The default value is 900 seconds. To allow very large uploads to complete it may be necessary to increase this value. To reset Connection Timeout:

  1. In IIS, right-click Default web Site and select Properties.


  2. Select the Web Site tab.


  3. In the Connection Timeout box, enter a new value.

Top


MaxClientRequestBuffer
MaxClientRequestBuffer is only relevant for the ISAPI filter. If you are using the HttpModule you do not have to adjust this setting.

The IIS parameter MaxClientRequestBuffer sets a maximum size for the first chunk of a request. The first chunk will usually contain only a request's line and header fields, which includes all data in a request that is not part of the request's entity body. The default value of MaxClientRequestBuffer is 128 KB.

FileUp's ISAPI filter creates a new request and sends the entire request to ASP or ASP.NET as one chunk. When an upload contains many files, the ISAPI filter request may exceed the default value of MaxClientRequestBuffer and IIS might reject the request. To prevent this, add a MaxClientRequestBuffer key to the registry and set it to an appropriate value. Many factors can affect the size of the ISAPI filter request, but it will usually be around 128 KB per 600 uploaded files. To add MaxClientRequestBuffer to the registry and set it to a new value:

  1. Open the Start menu and select Run...


  2. Enter regedit and click Ok.


  3. Open the folder HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\.


  4. From the Edit menu select New -> DWORD Value.


  5. Right-click the new key and rename it MaxClientRequestBuffer.


  6. Double-click MaxClientRequestBuffer An Edit DWORD Value dialog will open.


  7. Under Base select Decimal.


  8. In the Value Data field, enter a buffer size in kilobytes.

Top


.NET Settings

In the .NET configuration file for your web application - web.config or machine.config - there are several attributes that can affect the performance of large uploads. To set these attributes at the machine level, modify machine.config (located in [windows directory]\Microsoft.NET\Framework\[.NET Version Directory]\CONFIG). To set the attributes at the application level, modify your application's web.config file.

You will find the following values in the httpRuntime node of machine.config:

  • executionTimeout
    Time in seconds before a request is timed out.


  • maxRequestLength
    Maximum request size in kilobytes that ASP.NET will accept.


  • appRequestQueueLimit
    Maximum number of requests queued for an ASP.NET application. The default value of appRequestQueueLimit is 100. If your server will be handling more than 100 concurrent requests, increase the value of appRequestQueueLimit.


The following attributes are in the processModel node of machine.config:

  • responseDeadlockInterval
    Specifies the time interval, in the format HH:MM:SS, after which the process will be restarted if the following conditions are met:
    • There are queued requests.
    • There has not been a response during this interval.
    The default value of responseDeadlockInterval is 3 minutes. To allow very large uploads, you may have to increase this value. This property must be set in machine.config, not at the application level in web.config. It will affect any response deadlock in ASP.NET and should be used with caution.


  • 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. This prevents thrashing on processes that require a relatively long startup time. The default value of responseRestartDeadlockInterval is 9 minutes. To allow very large uploads, you may have to increase this value. This property must be set in machine.config, not at the application level in web.config. It will affect any response deadlock in ASP.NET and should be used with caution.

  • maxIoThreads

  • Maximum number of IO threads per CPU in the thread pool. The default value of maxIoThreads is 25. Increasing this value will increase the number of concurrent executing requests, significantly reducing the amount of time it takes to process concurrent requests. This value is particularly important for large uploads using the HttpModule. If you expect many concurrent uploads to your site, you should set maxIoThreads to the number of concurrent uploads that you wish to support.

Top


Copyright © 2005, SoftArtisans, Inc.