.net 報錯如下: System.Web.HttpException: 超過了最大請求長度。解決方案:
IIS10 中找到所需要修改的站點,需要修改兩個地方,最終webconfig如下:
可以從wobconfig修改,也可以從iis站點下的配置編輯器修改。
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<!--最大請求長度,單位為KB(千字節),默認為4M,設置為1G,上限為2G -->
<httpRuntime maxRequestLength="40960" targetFramework="4.5.2" />
</system.web>
<appSettings>
<add key="FileType" value=".doc,.xls,.txt,.rar" />
<add key="PicTureTye" value=".jpg|.gif|.png|.bmp|.psd|.svg|" />
<add key="FileSizeLimit" value="10240" />
</appSettings>
<location path="" overrideMode="Deny">
</location>
<system.webServer>
<security>
<requestFiltering>
<!--允許上傳文件長度,單位字節(B),默認為30M,最大為2G -->
<requestLimits maxAllowedContentLength="300000000" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
1、點擊“Winmail的網站”右邊的,管理下打開“配置編輯器”
在“節”選項下找到system.webServer/security/requestFiltering
編輯requestLimits下的maxAllowedContentLength。默認為30M。修改後點擊“應用”


2、在節“system.web/httpRuntime” 下修改,單位是KB

原創文章,作者:簡單一點,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/7004.html