![](/img/trans.png)
[英]How to set the maxAllowedContentLength upper 4,294,967,295 bytes while running on IIS7?
[英]How to set the maxAllowedContentLength to 500MB while running on IIS7?
我将 maxAllowedContentLength 更改为
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="5024000000" />
</requestFiltering>
</security>
在我的 web.config 中,但在 IIS7 上运行时出现此错误:
“maxAllowedContentLength”属性无效。 不是有效的无符号整数
但是当我在 VS 服务器中运行时,它运行正常,没有任何错误。
如何配置我的网站以允许上传 500MB 大小的文件,而在 IIS7 上没有这个问题?
.Net 中的请求限制可以从两个属性一起配置:
Web.Config/system.web/httpRuntime/maxRequestLength
Web.Config/system.webServer/security/requestFiltering/requestLimits/maxAllowedContentLength
(以字节为单位)参考资料:
示例:
<location path="upl">
<system.web>
<!--The default size is 4096 kilobytes (4 MB). MaxValue is 2147483647 KB (2 TB)-->
<!-- 100 MB in kilobytes -->
<httpRuntime maxRequestLength="102400" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!--The default size is 30000000 bytes (28.6 MB). MaxValue is 4294967295 bytes (4 GB)-->
<!-- 100 MB in bytes -->
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
</system.webServer>
</location>
IIS v10 (但这对于 IIS 7.x 也应该相同)
为正在寻找各自最大值的人快速添加
maxAllowedContentLength
最大值为: UInt32.MaxValue
🡒 4294967295 bytes
: ~4GB
maxRequestLength
最大值为: Int32.MaxValue
🡒 2147483647 bytes
: ~2GB
网页配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<!-- ~ 2GB -->
<httpRuntime maxRequestLength="2147483647" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- ~ 4GB -->
<requestLimits maxAllowedContentLength="4294967295" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.