HttpException (0x80004005): 超过了最大请求长度
1.Web.config中配置以下节点(基操勿六)
A:
<system.web>
<!--最大请求长度,单位为KB(千字节),默认为4M,设置为1G,上限为2G -->
<httpRuntime targetFramework="4.5" maxRequestLength="1048576" executionTimeout="3600" />
</system.web>
B:
<system.webServer>
<!--允许上传文件长度,单位字节(B),默认为30M,设置为1G,最大为2G -->
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824"/>
</requestFiltering>
</security>
</system.webServer>
2.关键点:代码经过上述设置完成后,本地可能调试依然报错,且发布到服务器同样报错。
原因:因为操作系统或IIS环境原因,代码中对Web.config所做修改操作,并未出现在编译后的Web.config文件中,需要手动在IIS站点的Web.config文件中重新修改即可。
HttpException (0x80004005): 超过了最大请求长度
最新推荐文章于 2023-04-14 14:56:09 发布