2016年11月8日 星期二

The request filtering module is configured to deny a request that exceeds the request content length.


今天遇到上傳檔案問題,
上傳後直接跳 404.13 error!
error message :
The request filtering module is configured to deny a request that exceeds the request content length.





已確定在 httpRuntime 的 maxRequestLength 屬性設定上傳檔案大小的限制,
卻還是活生生的發生這個問題
<system.web>
  <httpRuntime maxRequestLength="104857600" targetFramework="4.6.1" />
</system.web>

搜尋了一下,原來還要在 system.webServer/security/requestFiltering/requestLimits 的
maxAllowedContentLength 屬性設定上傳檔案的限制,可以正常啦!
<system.webServer>
 <security>
  <requestFiltering>
   <requestLimits maxAllowedContentLength="104857600"></requestLimits>
  </requestFiltering>
 </security>
</system.webServer>


附上網友的說明:
The maxRequestLength indicates the maximum file upload size supported by ASP.NET, the maxAllowedContentLength specifies the maximum length of content in a request supported by IIS. Hence, we need to set both maxRequestLength and maxAllowedContentLength values to upload large files.

沒有留言:

張貼留言