.net中默只能上傳小於4m的檔案,大於4M將無法顯示頁面.那麼如何設定來使imputfile能上傳更大的檔案呢,
1,環境:window 2003 ,IIS6.0
要首先要修改IIS6.0中的asp請求的最大位元組數,預設時為200K;
方法:開啟位於 C:\Windows\System32\Inetsrv 中的 metabase.XML,
並修改 AspMaxRequestEntityAllowed 為你需要的值(例如 "1073741824", 1GB);
技術背景:
在 IIS 6.0 中, AspMaxRequestEntityAllowed 屬性指定了一個 ASP 請求(Request)可以使用的最大位元組數. 如果 Content-Length 頭資訊中包含的請求長度超過了 AspMaxRequestEntityAllowed 的值, IIS 將返回一個 403 錯誤資訊.
這個屬性值與 MaxRequestEntityAllowed 相似, 但是是針對 ASP 請求的. 假如你知道自己的 ASP 應用只需要處理很少的請求資料, 你可以在 World Wide Web Publishing Service (WWW 發布服務)層級設定全域的 MaxRequestEntityAllowed 屬性為 1MB, 並單獨設定 AspMaxRequestEntityAllowed 為一個較小的值.
注意: 在編輯檔案前請停止 IIS 服務, 否則無法儲存修改後的檔案.
也可以那麼解決:
到微軟網站載了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屬性(預設為200K=204800),修改為1G就是了;同時修改了AspScriptTimeout屬性調整下時限,就可以上傳大檔案了。
2,.net中
(1)在web.comfig檔案中添加一個httpRuntime主鍵
<httpRuntime executionTimeout="90" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false"
minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>
maxRequestLength="40960" 是最大的請求數,單位為:K
(2)修改C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\machine.config檔案
<httpRuntime executionTimeout="190" maxRequestLength="40960"
maxRequestLength="40960" 是最大的請求數,單位為:K
經實驗,(1)和(2)只要一個就可以.