
在讀取資料庫時,若程式一次撈出來的資料有好幾萬筆,資料檔案大小很容易就超出預設4MB,這時候就會報錯
Maximum request length exceeded. (超出最大的要求長度)
一般來說ASP.NET讀取資料或上傳檔案時,預設是4MB,最大限制大小是2GB
如果Config限制大小沒設定時,一超過大小就會出錯
這時候就可以在Config檔上面調整資料大小
雖說Config將限制調整更大是可以Work
但是當在處理大檔案或資料時,等待時間會非常久
Config設定
<configuration>
<system.web>
<httpRuntime maxRequestLength="1048576" />
</system.web>
</configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>