[英].NET doesn't read properly web.config?
I have 我有
<system.web>
<httpRuntime maxRequestLength="500000000" />
</system.web>
But when I read web.config via 但是当我通过浏览web.config时
Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath);
HttpRuntimeSection section =
(HttpRuntimeSection)config.GetSection("system.web/httpRuntime");
I see 4096 value for maxRequestLength
!! 我看到
maxRequestLength
值为4096 !!
How it could be?? 它怎么可能? Thanks for any clue!
谢谢你的任何线索!
PS It is ASP .NET MVC3 Razor project PS它是ASP .NET MVC3 Razor项目
There are a number of things to consider: 有许多事情需要考虑:
If you're using IIS then I recommend using the Configuration editor to investigate configuration precedence. 如果您使用的是IIS,我建议使用配置编辑器来调查配置优先级。
My guess is that 500,000,000 Kb is above the maximum value for the maxRequestLength
property, so it's being assigned its default value (4,096). 我的猜测是500,000,000 Kb高于
maxRequestLength
属性的最大值,因此它被分配了默认值(4,096)。 The documentation does not say what's the maximum value that maxRequestLength
can take, but my guess is 20,97,151 Kb because that's roughly equal to 2^31 bytes, the maximum value that int
can store. 文档没有说明
maxRequestLength
可以采用的最大值是多少,但我的猜测是20,97,151 Kb,因为它大约等于2 ^ 31字节,即int
可以存储的最大值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.