Windows 7 IIS 7.5 ASP. NET file upload size limit

Source: Internet
Author: User

Is 7 default file upload size 30 m
To break through this restriction:

1. Modify IIS applicationhost. config
Open % WINDIR % \ system32 \ inetsrv \ config \ applicationhost. config
Find: <requestfiltering> node,
This node has no <requestlimits maxallowedcontentlength = "upload size value (unit: byte)"/> element by default, the maximum value tested on IIS 7 and IIS 7.5 is <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: The % WINDIR % \ system32 \ inetsrv \ config \ applicationhost. config file must not be replaced with files on other machines; otherwise, IIS will not be able to start
This file records all the site and app pool information in IIS and some machine-related configurations.

2. modify web. config

<System. Web>
<HttpruntimeExecutiontimeout= "36000"Maxrequestlength= "2097151"/><! --Maxrequestlength: size of the upload, in the unit of K, executiontimeout: Set the timeout time, in the unit of seconds. (90 seconds by default)-->
</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:
Line 117:
< Httphandlers />
Line 118:
< Customerrors Mode = "Remoteonly" />
Line 119:
< Httpruntime Executiontimeout = "36000" Maxrequestlength = "4194304" />
Line 120:
< Authentication Mode = "Windows" />
Line 121:
< Identity Impersonate = "True" />

3. If the following nodes exist under Web. config (this node is designed for IIS 7), modify

 <  Requestlimits  Maxallowedcontentlength  = "2147483647"     />  Unit and in applicationhost. config <  Requestlimits  Maxallowedcontentlength  = "2147483647"     />  The 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.

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.