ASP. Net file upload size limit solution modify IIS7/7.5 Configuration

Source: Internet
Author: User
Find an open-source Brettle on the Internet. web. neatUpload. IIS5.1 is easy to use on the customer's Windows 2008 server IIS7. I can see a solution on the Internet, but I didn't find the node mentioned in it. It may be on IIS7.5. the content is as follows:

In IIS 7, the default file upload size is 30 mb. This limit must be exceeded:

1. modify IIS applicationhost. config open % windir % \ system32 \ inetsrv \ config \ applicationhost. config found: <requestFiltering> node. By default, this node does not have <requestLimits maxAllowedContentLength = "upload size value (unit: byte)"/> element, the maximum value tested on IIS 7 and IIS 7.5 can only be <requestLimits maxAllowedContentLength = "4294967295"/> <4 GB. Add the following example element to this node: <requestLimits maxAllowedContentLength = "2147483647"/>. The upload size is changed to 2 GB. Note: % windir % \ system32 \ inetsrv \ config \ applicati Onhost. do not replace the config file with the files of other machines. Otherwise, IIS will not be able to start this file record. All Site and App pool information in IIS, as well as some machine-related configurations.

2. modify web. config <system. web>

Note: The maximum value of maxRequestLength can only be 2097151 K. If the value is greater than this value, the following Error occurs: Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The value for the property 'maxrequestlength' is not valid. The error is: The value must be inside the range 0-2097151.

Source Error:

<HttpHandlers/> <customErrors mode = "RemoteOnly"/>

3. web. if the following nodes exist in config (this node is designed for IIS 7), modify the <requestLimits maxAllowedContentLength = "2147483647"/> unit and applicationhost. <requestLimits maxAllowedContentLength = "2147483647"/> in config is the same, and its maximum value is only 4294967295 <system. webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength = "2147483647"/> </requestFiltering> </security> </system. webServer>

Conclusion: The maximum size of files uploaded by asp.net (IIS 7 and IIS 7.5) cannot exceed 2 GB.

The steps are not cumbersome, but I did not find the <requestLimits> node. Helpless

Looking back, the answer is in the dark

In fact, the cause of the error analyzed above is correct, that is, the maximum file size allowed to be uploaded in IIS is more than 20 mb by default. Therefore, this error is reported only when a large file is uploaded. Later, this setting was modified in another way.

The target is to modify the file C: \ Windows \ System32 \ inetsrv \ config \ schema \ IIS_schema.xml. The green underline area shows the target location to be modified.

<Element name = "requestLimits"> <attribute name = "maxAllowedContentLength" type = "uint" defaultValue = "30000000"/> <attribute name = "maxUrl" type = "uint" defaultValue = "4096"/> <attribute name = "maxQueryString" type = "uint" defaultValue = "2048"/> <element name = "headerLimits"> <collection addElement = "add" clearElement = "clear" removeElement = "remove"> <attribute name = "header" type = "string" required = "true" isUniqueKey = "true" validationType = "nonEmptyString"/> <attribute name = "sizeLimit" type = "uint" required = "true"/> </collection> </element>

The problem is that the file is read-only, that is, the Administrator permission cannot be modified. You must first modify the File Permission and then remove the read-only attribute.

1. Right-click a file and choose Properties> Security. Select the target user and click Advanced to modify the file owner;

2. Click "edit" to modify the permissions of the current user and add the "write" permission. Now, the permission settings are OK.

3. Remove the read-only attribute of the file.

4. Open VS as an administrator, edit the target XML file in VS, and modify the desired location.

5. Upload a m video. OK.

So far, the success is achieved.

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.