If you are using windows iis, you may find that uploading large files cannot be uploaded. Baidu later found that iis7 restricts the size of the uploaded files. We only need to modify the web. maxRequestLength in config.
In IIS7, even if you are on the web. config sets maxRequestLength = "1048576" to the maximum size that can be uploaded. In fact, it is affected by C:/Windows/System32/inetsrv/config/applicationHost. by default, only 30 mb files can be uploaded. You can modify this file. add in webServer/security/requestFiltering/Section
<RequestLimits maxAllowedContentLength = "<length>"/>
Modify <length> to the allowed size. Note that the unit here is bytes, and the unit of maxRequestLength in web. config is KB.
The procedure is as follows:
The target is to modify the file C:/Windows/System32/inetsrv/config/schema/IIS_schema.xml. The red underline indicates the target location to be modified.
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 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.
After modification, restart IIS.