net(C#)项目:当你上传的文件过大时,会提示错误 413 Request Entity Too Large
解决办法:
<configuration>
<system.web>
<compilation targetFramework="4.6.1" />
<httpRuntime executionTimeout="600" maxRequestLength="102400" targetFramework="4.6.1" />
maxRequestLength<!--单位:KB 3072=3MB 默认是4MB,最大支持2GB-->
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="107374182" />
<!--单位:字节B 2147483648=2 GB 默认是4MB,最大支持2GB-->
</requestFiltering>
</security>
</system.webServer>
</configuration>
注意: maxRequestLength的单位是KB,而maxAllowedContentLength的单位是字节,既然是请求,那么指的不仅仅是上传文件,只要是用户发送的请求,都可以通过上面的配置限制,比如Ajax请求服务器接口,参数内容超过了设置的最大长度就会请求失败!