Windows 7 IIS 7.5 預設限制上傳檔案大小,導致 ASP 上傳大檔案報錯 Request 對象 錯誤 ASP 0104 : 800004005。需同時修改兩處配置才能生效。
上傳超過 200KB 檔案時失敗,經典 ASP 程式碼無誤,純屬 IIS 限制。
200000 (bytes, 約 200KB) → 修改為所需值 (如 314572800 = 300MB)。30000000 (≈30MB) → 改為 314572800 (300MB)。關鍵: 兩處必須同時修改,否則仍受限於較小值。
路徑:C:\Windows\System32\inetsrv\config\applicationHost.config
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="314572800" />
</requestFiltering>
</security>
<asp>
<limits maxRequestEntityAllowed="314572800" />
</asp>
</system.webServer>
需管理員權限編輯,且格式錯誤會導致 IIS 無法啟動,建議透過 GUI 操作。
上傳 50MB、100MB 測試檔案,確認無錯誤並檔案完整。
若為 ASP.NET 應用,另需在 web.config 設定:
<system.web>
<httpRuntime maxRequestLength="307200" executionTimeout="600" /> <!-- KB -->
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="314572800" /> <!-- Bytes -->
</requestFiltering>
</security>
</system.webServer>
注意單位差異:maxRequestLength 以 KB 為單位,maxAllowedContentLength 以 Bytes 為單位。