IIS 出於安全考慮, 默認最大文件請求爲200K(也即最大提交數據限額爲200KByte, 204800Byte).
這個屬性值保存在C:/WINDOWS/system32/inetsrv/MetaBase.xml 文件的AspMaxRequestEntityAllowed屬性值
中,默認爲204800byte 即爲200K
如果在window應用程序開發中,需要請求大於200K的文件時,需要修改AspMaxRequestEntityAllowed值
方法一:
1. 關閉 IIS Admin Service 服務
2. 用計事本打開 /Windows/system32/inesrv/metabase.xml
3. 找到ASPMaxRequestEntityAllowed 把他修改爲需要的值,默認爲204800,即200K
把它修改爲51200000(50M)
4.重啓iis admin service
方法二:
1. 新建文本文件:
'use VBS
set obj1=GetObject("winmgmts:/root/MicrosoftIISv2")
set obj2=obj1.get("IIsWebVirtualDirSetting='W3SVC/1/ROOT'")
'Output default value
WScript.Echo "AspMaxRequestEntityAllowed Default Value: " & obj2.AspMaxRequestEntityAllowed
'Reset the value
obj2.AspMaxRequestEntityAllowed=1024000 ' set to 1mbyte, u can set to other what you want :)
' Save data
obj2.Put_()
'Output new value
WScript.Echo "AspMaxRequestEntityAllowed New Value: " & obj2.AspMaxRequestEntityAllowed
2. 保存爲requestchange.vbs
3. 進入命令行, 運行:
cscript [path]requestchange.vbs