在IIS 6.0中,不設置默認大小為4M,設置文件上傳大小的方法,maxRequestLength(KB),executionTimeout(毫秒),配置如下節點:
<system.web> <httpRuntime maxRequestLength="102400" executionTimeout="300000"/> </system.web>
在IIS7中,設置如上設置后,不管設置多大數值,最大上傳了限制為30M,還要進行如下設置才能正確:
方法1:
appcmd set config "My Site/MyApp" -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600 -commitpath:apphost
在IIS服務器的命令行執行如上命令,注意修改上面的網站名稱和上傳文件大小
方法2:
在web.config中加入如下配置:
<system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="1048576000"></requestLimits> </requestFiltering> </security> </system.webServer>
以下方法是不正確或不好的方法:
(1)修改:“C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml”文件,但這樣確實能做到,但如果在系統安裝補丁時,有可能對這個文件進行覆蓋,設置就會失效,需重新設置;
(2)修改: