標籤:安裝 nbsp flow increase https stl 添加 asp 篩選
1、起因
今天同事在上傳檔案的時候,發現一直失敗,說檔案比較大。一聽就明白了,肯定是上傳檔案大小的問題啊。然後查看web.config檔案,發現設定過檔案上傳的大小限制。設定檔上傳大小,分為2部分。
<httpRuntime maxRequestLength="1073741824" executionTimeout="3600" useFullyQualifiedRedirectUrl="true" requestValidationMode="2.0" />
2、web.config級設定
此處的maxRequestLength設定是.net級的設定,單位是KB
<httpRuntime maxRequestLength="1073741824" executionTimeout="3600" useFullyQualifiedRedirectUrl="true" requestValidationMode="2.0" />
3、IIS伺服器級設定
這裡有2種方式:
1)iis管理器端設定,找到自己的網站。前提是在安裝iis的時候,有安裝要求篩選,如。然後選擇要求篩選,編輯功能設定,把允許的最大內容長度更改為所需要的大小,注意這裡單位是位元組。這裡確定後,iis會自動在web.config中添加一段代碼。這也是下面要介紹的第2種方式。
2)在web.config中的system.webServer中添加配置。注意,單位是位元組。
<security> <requestFiltering> <requestLimits maxAllowedContentLength="8703144" /> </requestFiltering> </security>
參考文檔:
https://stackoverflow.com/questions/6327452/which-gets-priority-maxrequestlength-or-maxallowedcontentlength
https://forums.asp.net/t/1965933.aspx?increase+upload+limit+system+webServer+security+requestFiltering+requestLimits+maxAllowedContentLength+10485760+requestFiltering+security+system+webServer+
.Net上傳檔案大小配置