一、 修改IIS的applicationhost.config,文件位置: %windir%/system32/inetsrv/config/applicationhost.config
找到<requestFiltering>节点,该节点下默认没有 <requestLimits maxAllowedContentLength="上传大小的值(单位:byte)" /> 元素。
为这个节点添加以下元素:<requestLimits maxAllowedContentLength="2147483647" /> (上传的大小将改成2GB)web
二、 通过这个设置后,服务器对上传文件的大小限制将变为2147483647bytes了。固然,这个设置是服务器级别的,若是你想在某个站点或 者某个应用上限制大小,也能够经过以相同方式进行设置,只不过此次设置的是站点内的Web.config。
可是你要进行此项修改,要确保applicationhost.config中对该项修改的权限已经放开。可经过以下设置进行更改:
若overrideModeDefault的值为Deny,则修改它的值为Allow,以下:
<sectionGroup name="system.webServer">
<section name="requestFiltering" overrideModeDefault="Allow" />
</sectionGroup>
确认修改过applicationhost.config中上述设置之后,再进行以下设置。
找到应用的Web.config,把如下内容加在<system.webServer>节点:
<security>
<requestFiltering >
<requestLimits maxAllowedContentLength="2147483647" ></requestLimits>
</requestFiltering>
</security>服务器
三、 设置单个请求的最大长度为200MB,修改web.config中 configuration节点下的 system.web节点下的 httpRuntime 节点增长 maxRequestLength="204800" executionTimeout="120"app