服務(wù)熱線
153 8323 9821
.net中默只能上傳小于4m的文件,大于4M將無(wú)法顯示頁(yè)面.那么如何設(shè)置來(lái)使imputfile能上傳更大的文件呢,
1,環(huán)境:window 2003 ,IIS6.0
要首先要修改IIS6.0中的asp請(qǐng)求的最大字節(jié)數(shù),默認(rèn)時(shí)為200K;
方法:打開(kāi)位于 C:\Windows\System32\Inetsrv 中的 metabase.XML,
并修改 AspMaxRequestEntityAllowed 為你需要的值(例如 "1073741824", 1GB);
技術(shù)背景:
在 IIS 6.0 中, AspMaxRequestEntityAllowed 屬性指定了一個(gè) ASP 請(qǐng)求(Request)可以使用的最大字節(jié)數(shù). 如果 Content-Length 頭信息中包含的請(qǐng)求長(zhǎng)度超過(guò)了 AspMaxRequestEntityAllowed 的值, IIS 將返回一個(gè) 403 錯(cuò)誤信息.
這個(gè)屬性值與 MaxRequestEntityAllowed 相似, 但是是針對(duì) ASP 請(qǐng)求的. 假如你知道自己的 ASP 應(yīng)用只需要處理很少的請(qǐng)求數(shù)據(jù), 你可以在 World Wide Web Publishing Service (WWW 發(fā)布服務(wù))層級(jí)設(shè)定全局的 MaxRequestEntityAllowed 屬性為 1MB, 并單獨(dú)設(shè)定 AspMaxRequestEntityAllowed 為一個(gè)較小的值.
注意: 在編輯文件前請(qǐng)停止 IIS 服務(wù), 否則無(wú)法保存修改后的文件.
也可以那么解決:
到微軟站點(diǎn)載了IIS6 Resource Kit Tools(http://www.microsoft.com/downloads/details.aspx?FamilyID=56FC92EE-A71A-4C73-B628-ADE629C89499&displaylang=en),安裝后利用Metabase Explorer修改了(local)\LM\W3SVC\AspMaxRequestEntityAllowed屬性(默認(rèn)為200K=204800),修改為1G就是了;同時(shí)修改了AspScriptTimeout屬性調(diào)整下時(shí)限,就可以上傳大文件了。
2,.net中
(1)在web.comfig文件中添加一個(gè)httpRuntime主鍵
<httpRuntime executionTimeout="90" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"
minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>
maxRequestLength="40960" 是最大的請(qǐng)求數(shù),單位為:K
(2)修改C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config文件
<httpRuntime executionTimeout="190" maxRequestLength="40960"
maxRequestLength="40960" 是最大的請(qǐng)求數(shù),單位為:K
經(jīng)實(shí)驗(yàn),(1)和(2)只要一個(gè)就可以。