6

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.

4
  • Well the performance impact will be that every time someone uploads a massive file it will use that much bandwidth..... Commented Mar 6, 2013 at 13:44
  • it's around 2 GB for IIS 7 (but @Liam consideration about bandwidth is true). If you really need that...it's better to implement another interface for file uploading (for example using POSTs and custom browser extensions). Commented Mar 6, 2013 at 13:46
  • @Liam,@Adriano The application will be hosted on intranet and hence bandwidth available is more. But i want to restrict the user to some limit as if IIS is engaged in catering 100MB-200MB files the other users of website will get lower performance. Commented Mar 6, 2013 at 14:08
  • 1
    @Pratik not to mention the other users of your network! even on gigabit ethernet, you get 5 users uploading a 100Mb file, thats going to hurt! Commented Mar 6, 2013 at 14:12

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

3 Comments

-1, no, it's expressed in KB and the limit is much lower (2,097,152 KB = 2 GB)
@Adriano I didn't mention anything about the qualification of the number. However, it is good to know that it is KB, I'll update my answer.
@DavinTryon The explaination is very useful in justifying the limits of ASP.net file upload control. Thanks a lot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.