C #. Net file size limit settings

Source: Internet
Author: User
Tags metabase

In. net, only files smaller than 4 MB can be uploaded, and pages cannot be displayed if they are larger than 4 MB. How can we set imputfile to upload larger files,

1. Environment: Window 2003, iis6.0

First, you must modify the maximum number of ASP requests in iis6.0. The default value is 200 K;
Method: Open metabase. XML in c: \ windows \ system32 \ inetsrv,
Modify aspmaxrequestentityallowed for the value you need (such as "1073741824", 1 GB );

Technical Background:
In IIS 6.0, the aspmaxrequestentityallowed attribute specifies the maximum number of bytes that an ASP request can use. if the request length contained in the Content-Length header exceeds the value of aspmaxrequestentityallowed, IIS returns a 403 error message.
This attribute value is similar to maxrequestentityallowed, but is for ASP requests. if you know that your ASP application only needs to process a small amount of request data, you can set the global maxrequestentityallowed attribute at the World Wide Web Hing Service (WWW Publishing Service) level to 1 MB, set aspmaxrequestentityallowed to a smaller value.

Note: Stop the IIS service before editing the file. Otherwise, the modified file cannot be saved.

It can also be solved as follows:
IIS6 Resource Kit tools (http://www.microsoft.com/downloads/details.aspx? Familyid = metric & displaylang = EN). After installation, you modified the attribute (local) \ lm \ W3SVC \ aspmaxrequestentityallowed (200 k = 204800 by default) using metabase explorer and changed it to 1 GB; at the same time, the aspscripttimeout attribute is modified to adjust the time limit so that you can upload large files.

2, in. net

(1) Add an httpruntime primary key to the Web. comfig file.

<Httpruntime executiontimeout = "90" maxrequestlength = "40960" usefullyqualifiedredirecturl = "false"
Minfreethreads = "8" minlocalrequestfreethreads = "4" apprequestqueuelimit = "100"/>

Maxrequestlength = "40960" indicates the maximum number of requests. The unit is K.

(2) modify the c: \ windows \ Microsoft. NET \ framework \ v1.1.4322 \ config \ machine. config file

<Httpruntime executiontimeout = "190" maxrequestlength = "40960"

Maxrequestlength = "40960" indicates the maximum number of requests. The unit is K.

After the experiment, (1) and (2) only one can be used.

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.