须要在配置文件里面设置文件上传限定的两个属性值:maxAllowedContentLength,maxRequestLength 容许上传文件的长度,和请求的长度,两个大小须要设置一致,若是不一致,则以请求长度为准。(设置的单位都为byte)
默认请求长度只有4M.web
<system.web> <httpRuntime maxRequestLength="2147483647" executionTimeout="36000" delayNotificationTimeout="36000"/> </system.web> <system.webServer> <security> <requestFiltering> <!--<requestLimits maxAllowedContentLength="1073741824"/>--> <requestLimits maxAllowedContentLength="2147483648"/> </requestFiltering> </security> </system.webServer>
确保applicationhost.config中对该项修改的权限已经放开
applicationhost.config文件路径在 C:\Windows\System32\inetsrv\config 下
将requestFiltering从"Deny"改成"Allow"服务器
<sectionGroup name="system.webServer"> <sectionGroup name="security"> <section name="requestFiltering" overrideModeDefault="Allow" /> </sectionGroup> </sectionGroup>
在applicationhost.config文件中加上如下字段app
<system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="2147483647" /> </requestFiltering> <security> <system.webServer>
能够经过命令行修改ide
%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:2147483647