windows7 下 IIS 默認文件上傳大小時30M
要突破這個限制需要做一下修改:
1.打開 %windir%\system32\inetsrv\config\applicationhost.config 找到: <requestFiltering>節點
這個節點默認沒有 <requestLimits maxAllowedContentLength="上傳大小的值(單位:byte)" /> 元素,IIS 7和IIS 7.5上測試過 最大值只能是<requestLimits maxAllowedContentLength="4294967295" /> <4GB,
爲這個節點新增如下事例元素:<requestLimits maxAllowedContentLength="2147483647" /> ,上傳的大小將改爲2G
注意:%windir%\system32\inetsrv\config\applicationhost.config 文件一定不要用其他機器的文件替換,否則IIS將無法啓動 此文件記錄了,當前IIS中所有Site , App pool的信息,還有一些與機器相關的配置。
2.修改web.config
<system.web> <httpRuntime executionTimeout="36000" maxRequestLength="2097151"/> <!--maxRequestLength:上傳的大小,單位K ,executionTimeout:設置超時時間,單位:秒。(默認是90秒) --> </system.web>
3.web.config下如果有如下節點(此節點是爲IIS 7設計的) ,則修改:
<requestLimits maxAllowedContentLength="2147483647" /> 單位與applicationhost.config中的<requestLimits maxAllowedContentLength="2147483647" />一致,它的最大值也只能爲4294967295<system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="2147483647" /> </requestFiltering> </security> </system.webServer>