Home
english
Home
.NET Server
Java Server
.NET Client
AJAX Client
AJAX Browser
Map Drive
Pricing
Contacts
info@ithit.com



Uploading Large Files to IIS / ASP.NET

Max Upload File Size in IIS and ASP.NET

While IT Hit WebDAV server engine can process files of any size (up to 8,589,934,592 Gb) the hosting environment or you WebDAV client may not support large files upload.

If you host your WebDAV server in IIS/ASP.NET you must specify the file maximum upload size in web.config of your web application. By default maximum upload size is set to 4096 KB (4 MB) by ASP.NET. To increase the upload limit add appropriate section to your web.config file and specify the limit:

In case of IIS 7.x, both Integrated and Classic mode:

<system.webServer>

  <security>

    <requestFiltering>

      <requestLimits maxAllowedContentLength="2147483648" />

    </requestFiltering>

  </security>

</system.webServer>

In case of IIS 6.0:

<system.web>

  <httpRuntime maxRequestLength="2097151" />

</system.web>

Important! The maximum file upload size for both ASP.NET 2.0 and ASP.NET 4.0 is 2097151Kb = 2Gb.

If you need to upload files larger than 2Gb you must implement resumable upload interfaces and upload files with segments. Note that you will need the WebDAV client application that supports resumable upload in this case, such as based on IT Hit WebDAV Client API for .NET.

Upload Content Buffering in ASP.NET 2.0

The file upload is performed differently in ASP.NET 4.0-based application, HttpListener-based application and in ASP.NET 2.0-based application. While ASP.NET 4.0 and HttpListener passes file content directly to the engine, the ASP.NET 2.0 first saves file content in a temporary folder limiting upload capabilities and increasing server load. To avoid upload buffering in ASP.NET 2.0 on servers side, the IT Hit WebDAV Server Engine provides ITHitPutUploadProgressAndResumeModule that also significantly improves upload speed. To use the module in your web application add it to modules section in web.config:

In case of IIS 7.x Integrated mode:

<system.webServer>

  <modules>

    <add name="ITHitPutUploadProgressAndResumeModule" type="ITHit.WebDAV.Server.ResumableUpload.PutUploadProgressAndResumeModule, ITHit.WebDAV.Server" preCondition="integratedMode" />

  </modules>

</system.webServer>

In case of IIS 7.x Classic mode and IIS 6.0:

<system.web>

  <httpModules>

    <add name="ITHitPutUploadProgressAndResumeModule" type="ITHit.WebDAV.Server.ResumableUpload.PutUploadProgressAndResumeModule, ITHit.WebDAV.Server" />

  </httpModules>

</system.web>

If you enable this module in ASP.NET 4.0 application it will be ignored.

Important! Always enable ITHitPutUploadProgressAndResumeModule in the following cases:
     - If you are running your application in Visual Studio Development Server (not recommended).
     - If you are implementing resumable upload interfaces and hosting your server in ASP.NET 2.0.

Important! With ITHitPutUploadProgressAndResumeModule module you must always use the DavContextBase(HttpContext) constructor.

Upload Timeout

To prevent canceling script execution when uploading a large file to application hosted in IIS / ASP.NET you must increase script timeout value:

HttpContext.Current.Server.ScriptTimeout = 2400; // timeout in seconds

Note that if you store your data in a database, often timeout may be caused by a database connection.


 

 

comments powered by Disqus

Selected Customers:
USA
Symantec
Country: Sweden
Toyota
Country: USA
Microsoft
Country: Ukraine
Raiffeisen Bank
Country: USA
Siemens
Country: USA
Lockheed Martin
Country: USA
Intel Corporation
Country: Germany
SAP AG
Country: Israel
Autodesk, Inc.
Country: USA
U.S. Customs and Border Protection Agency
Have a question
about API?
Ask on StackOverflow


Found a bug or have a confidential question?
Write to info@ithit.com
Home .NET Server Java Server .NET Client AJAX Client AJAX Browser Map Drive Pricing Contacts

Updated: Sunday, April 01, 2012