IIS 7 默認限制上傳文件大小為 30MB(maxAllowedContentLength = 30000000 字節),超過即報 404 或「找不到文件或目錄」。本文演示修改 IIS_schema.xml 突破限制的完整步驟。
C:\Windows\System32\inetsrv\config\schema\IIS_schema.xmlIIS_schema.xml,搜索 30000000(約第 1024 行),修改為所需值(如 300000000 = 300MB)。<element name="requestLimits">
<attribute name="maxAllowedContentLength" type="uint" defaultValue="300000000" />
<attribute name="maxUrl" type="uint" defaultValue="4096" />
<attribute name="maxQueryString" type="uint" defaultValue="2048" />
...





除 IIS 級別,應用程序 web.config 亦需放開限制:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="300000000" />
</requestFiltering>
</security>
</system.webServer>
<system.web>
<httpRuntime maxRequestLength="307200" executionTimeout="300" /> <!-- KB單位,300MB -->
</system.web>
iisreset 重啟 IIS。注意:修改系統配置文件有風險,操作前務必備份 IIS_schema.xml。生產環境建議配合應用層 web.config 設置,避免系統更新覆蓋導致失效。