Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum file size allowed by ASP.NET file upload Control

I am using File upload control in ASP.Net, followed the below blogs approach.

http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx

The 4MB default is set in machine.config, but you can override it in you web.config. For instance, to expand the upload limit to 20MB, you'd do this:

<system.web>
  <httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>

Question: Till what level(MAX size) i can increase the requested length and what will be performance impact on site if we allowed user to upload 50-60 MB files also.

like image 483
Pratik Avatar asked Mar 06 '13 13:03

Pratik


1 Answers

The 'theoretical' max level for the maxRequestLength field is the max value for signed 32-bit integer data type (Int32.MaxValue).

However, you are going to have to test the upload in order to understand your performance.

EDIT:

From a Microsoft support ticket:

Theoretically, the maximum file upload size is fairly large. However, because of ASP.NET health monitoring, you cannot upload very large files in ASP.NET. The ASP.NET worker process has a virtual address space of 2 gigabytes (GB). However, the ASP.NET worker process only uses a little more than 1 GB because of health monitoring and memory fragmentation.

During the upload process, ASP.NET loads the whole file in memory before the user can save the file to the disk. Therefore, the process may recycle because of the memoryLimit attribute of the processModel tag in the Machine.config file. The memoryLimit attribute specifies the percentage of physical memory that the ASP.NET worker process can exhaust before the process is automatically recycled. Recycling prevents memory leaks from causing ASP.NET to crash or to stop responding.

Additionally, other factors play a role in the maximum file size that can be uploaded. These factors include available memory, available hard disk space, processor speed, and current network traffic. With regular traffic of files being uploaded, Microsoft recommends that you use a maximum file size in the range of 10 to 20 megabytes (MB). If you rarely upload files, the maximum file size may be 100 MB.

Note You can upload files that are larger than 100 MB in ASP.NET. However, Microsoft recommends that you follow the maximum file upload sizes that are mentioned in this article. To determine more precise file sizes, perform stress testing on computers that are similar to the ones that will be used in production.

like image 160
Davin Tryon Avatar answered Sep 28 '22 02:09

Davin Tryon