Asp.net large file upload Size Control Scheme

Source: Internet
Author: User


By default,. Net allows uploading 4 m files.

Modify the machine. config file to change the value of the maxrequestlength parameter. Search for this file in the C: \ winnt \ microsoft.net directory.

Note: When saving a file, you should ensure the full path of the specified file and provide write permission for the Directory of the file to be stored for the account used by ASP. NET. When uploading a large file, you can use the maxrequestlength attribute of the web. config element to increase the maximum file size. For example:

<Configuration>
<System. Web>
<Httpruntimemaxrequestlength = "1048576" executiontimeout = "3600"/>
</System. Web>
</Configuration>

Maxrequestlength indicates the maximum number of bytes uploaded in http mode supported by ASP. NET (the maximum value is 2097150,2g ). The specified size is in KB. The default value is 4096 KB (4 MB ). Executiontimeout: indicates the maximum number of seconds allowed to execute a request before it is automatically disabled by ASP. NET. When the file size exceeds the specified size, if a DNS error occurs in the browser or the service is unavailable, modify the above configuration to increase the number of configurations.

When uploading a large file, you may receive the following error message:

Aspnet_wp.exe (PID: 1520) is recycled because the memory consumption exceeds 460 MB (60 percent of available RAM ).

If this error message is returned, add the value of the memorylimit attribute in the element of the web. config file of the application. For example:

<Configuration>
<System. Web>
<Processmodelmemorylimit = "80"/>
</System. Web>
</Configuration>

For Windows server2003:

Precautions for uploading large files on Windows Server 2003:

When a large attachment is uploaded on Windows Server 2003, The system reports an error:


1. Disable the IIS Admin Service in the service first.


2. Find metabase. xml under windows \ system32 \ inetsrv,
Open and find aspmaxrequestentityallowed to change it to the required value. The default value is 204800, that is, 200 K. Change it to 51200000 or greater [Determined by file size].


3. Restart the IIS Admin Service.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.