今天在測試一下上傳文件的時候發現iis和配置存在上傳文件大小限制(IIS默認大小30M,最大運行爲2g:2147483647),百度了一部分資料有些發佈到IIS好使,可是在VS調試中很差使。因而本身不斷努力仍是找到了問題點。不是說網上的不對,只不過是有些狀況下忽略了一些步驟。我就總結了一下我本次的步驟。web
配置web.config節點中的web節點:編輯器
<system.web> <compilation debug="true" targetFramework="4.5"/> <!--主要是maxRequestLength屬性--> <httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="6000"/> <pages controlRenderingCompatibilityVersion="4.5" clientIDMode="AutoID"/> </system.web>
仍是配置web.config節點,可是配置的是webServer節點。網上有人說這個是iis7以上才配置。測試
<system.webServer> <security> <requestFiltering> <!--主要是maxAllowedContentLength屬性--> <requestLimits maxAllowedContentLength="2147483647"></requestLimits> </requestFiltering> </security> </system.webServer>
注意:配置上以上兩步以後在VS中只是破除了上傳4M限制。請注意。我就是配置完這兩步後,上傳大於4M的好使了可是大於30的仍然不行。網上有些文檔大部分都是說道這裏。spa
配置IIS限制,打開IIS,找到配置編輯器。debug
點擊進入先在節點處 先選擇節點:system.web/httpRuntime後,再在列表下面找到maxRequestLength屬性配置上大小值。調試
不用退出第三步頁面,繼續切換節點到:system.webServer/security/requestFiltering後,找到requestLimits子節點,打開配置maxAllowedContentLength屬性大小值。code
完成之後從新啓動就能夠上傳文件了。blog