Amr*_*rhy 84 asp.net iis-7 file-upload .net-4.0
我将maxAllowedContentLength更改为
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="5024000000" />
</requestFiltering>
</security>
Run Code Online (Sandbox Code Playgroud)
在我的web.config中,但在IIS7上运行时出现此错误:
'maxAllowedContentLength'属性无效.不是有效的无符号整数

但是当我在VS服务器中运行时,它正常运行而没有任何错误.
如何配置我的网站允许上传500MB大小的文件,在IIS7上没有这个问题?
小智 124
.Net中的请求限制可以从两个属性配置在一起:
Web.Config/system.web/httpRuntime/maxRequestLengthWeb.Config/system.webServer/security/requestFiltering/requestLimits/maxAllowedContentLength (以字节为单位)参考文献:http : //www.whatsabyte.com/P1/byteconverter.htm https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits
例:
<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>
Run Code Online (Sandbox Code Playgroud)
Leg*_*nds 13
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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
151306 次 |
| 最近记录: |