須要在配置文件裏面設置文件上傳限定的兩個屬性值: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