如何解决IIS7上传文件大小限制【转】
在實際應(yīng)用中往往會出現(xiàn)上傳文件太大,無法上傳的情況,那是因為IIS對上傳文件大小有限制,IIS7 默認(rèn)文件上傳大小是30M,要突破這個限制需要做一下修改:
1.打開 %windir%\system32\inetsrv\config\applicationhost.config 找到: <requestFiltering>節(jié)點
這個節(jié)點默認(rèn)沒有 <requestLimits maxAllowedContentLength="上傳大小的值(單位:byte)" /> 元素,IIS 7和IIS 7.5上測試過 最大值只能是<requestLimits maxAllowedContentLength="4294967295" /> <4GB,
為這個節(jié)點新增如下事例元素:<requestLimits maxAllowedContentLength="2147483647" /> ,上傳的大小將改為2G
注意:%windir%\system32\inetsrv\config\applicationhost.config 文件一定不要用其他機器的文件替換,否則IIS將無法啟動 此文件記錄了,當(dāng)前IIS中所有Site , App pool的信息,還有一些與機器相關(guān)的配置。
2.修改web.config
<system.web><httpRuntime executionTimeout="36000" maxRequestLength="2097151"/>
<!--maxRequestLength:上傳的大小,單位K ,executionTimeout:設(shè)置超時時間,單位:秒。(默認(rèn)是90秒) -->
</system.web>
3.web.config下如果有如下節(jié)點(此節(jié)點是為IIS 7設(shè)計的) ,則修改:
<requestLimits maxAllowedContentLength="2147483647" /> 單位與applicationhost.config中的<requestLimits maxAllowedContentLength="2147483647" />一致,它的最大值也只能為4294967295<system.webServer><security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
</system.webServer>
轉(zhuǎn)載于:https://www.cnblogs.com/webyu/archive/2013/04/24/3039503.html
總結(jié)
以上是生活随笔為你收集整理的如何解决IIS7上传文件大小限制【转】的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [bbk5128]第12集 - Chap
- 下一篇: 应用程序文件Android安全分析挑战: