Server Error
404 – File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
用戶上傳一個大小大約為160MB的文件至服務器出現這個錯誤。Insus.NET把上傳文件於本機測試沒有問題。但上傳至服務器時,這個錯誤產生了。
本地可以,服務器卻Error。可以肯定程序代碼沒有問題,怎樣說呢?Insus.NET 測試嘗試上傳另一個相同的文件格式,只是大小有所改變,大小約為25MB,它即能成功上傳了。
Insus.NET檢查了web.config文件,可以上傳的文件限制已經設置相當大了200MB。
<
system.web
>
<
httpRuntime
maxRequestLength
="204800"
useFullyQualifiedRedirectUrl
="true"
minFreeThreads
="8"
minLocalRequestFreeThreads
="4"
appRequestQueueLimit
="100"
enableVersionHeader
="true"
executionTimeout
="6000"
/>
</
system.web
>
問題出於哪里?
找到資料,原來IIS 的maxAllowedContent Length的缺省值為30000000 bytes. 上傳大於這個長度的數據流被截斷,導致文件或目錄找不到。
因此Insus.NET嘗試在web.config更改這個設置,添加下面節點:
<
system.webServer
>
<
security
>
<
requestFiltering
>
<
requestLimits
maxAllowedContentLength
="2097152000"
maxQueryString
="5000"
maxUrl
="8000"
></
requestLimits
>
</
requestFiltering
>
</
security
>
</
system.webServer
>
最后測試上傳200MB的文件,能成功上傳。
出處:http://www.cnblogs.com/insus/archive/2012/08/09/2629920.html