Under the IIS7, even if you set the Maxrequestlength= "1048576" the maximum allowable upload size in web.config, it is also useless, is actually by the c:/windows/system32/inetsrv/config/ ApplicationHost.config limit, the default maximum can only upload 30M file, modify this file is good, in the system.webserver/security/requestfiltering/section of the file to add
<requestlimits maxallowedcontentlength = "<length>"/>
on the line, will <length> modify for the size you want to allow, note that the unit here is bytes, while web.config in the maxRequestLength Unit is KB
The specific methods are as follows
The goal is to modify the file C:/windows/system32/inetsrv/config/schema/iis_schema.xml. The Red underline section allows us to modify the target position.
The code is as follows |
Copy Code |
<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 this file is read-only and cannot be modified with administrator privileges. To modify the permissions of the file first, and then remove the read-only property.
1. Right key file-> attribute-> security, select Target user, click Advanced, modify file owner;
2. After the confirmation click Edit, you can modify the current user's permissions, add "Write" permission. At this point, the permission settings are OK.
3. Remove the read-only property of the file.
4. Open vs as Administrator, then edit the target XML file in VS, and modify the desired location.
Reboot IIS after modification.