1. 在用户自己的asp.net应用中修改web config文件,增加或修改以下红色背景内容即可
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="262144000"></requestLimits>
</requestFiltering>
</security>
2. 打开C:/Windows/System32/inetsrv/config/schema/IIS_schema.xml,找到如下内容:
复制内容到剪贴板
程序代码

<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>
</element>
<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>
</element>
将红色部分修改成合适大小即可[1],单位为字节。
说明
[1].IIS_schema.xml默认是无法修改的,即使是系统管理员也无法修改,必需修改下权限,再去掉其只读属性才可修改。
上图为IIS_schema.xml默认权限,直接点击"编辑"按钮你会发现权限是不能修改的,还得先做如下操作:
1).点击"高级"按钮进入高级安全设置界面;
2).切换到"所有者"选项卡,点"编辑"按钮,选中Administrators后确定;
现在可以在"安全"选项卡上点击"编辑"按钮,给Administrators增加修改和写入权限了,再去掉IIS_schema.xml只读属性,系统管理员就可以修改文件了。