其中获得优先权,或maxRequestLength的maxAllowedContentLength? [英] Which gets priority, maxRequestLength or maxAllowedContentLength?

查看:1272
本文介绍了其中获得优先权,或maxRequestLength的maxAllowedContentLength?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在改变上载所允许的最大文件大小在我这两个设置绊倒了。

While changing the maximum allowed file size for upload I stumbled on those two settings.

sytem.web 的你有 HTTP运行库的是的maxRequestLength 节点。
system.webServer 的你有 requestLimits 的是 maxAllowedContentLength

In the sytem.web you have the http runtime node with maxRequestLength. In the system.webServer you have the requestLimits with maxAllowedContentLength.

现在它比其他的得到优先考虑?而我们需要同时设置或者是最后一个(一个为IIS7)就够了吗?

Now which gets the priority over the other? And do we need to set both or is the last one (the one for IIS7) enough?

推荐答案

maxRequestLength的指示由ASP.NET支持的最大请求大小,而maxAllowedContentLength指定由IIS支持的请求内容的最大长度。所以,你需要同时设置为了上传大文件:较小的一个优先

maxRequestLength indicates the maximum request size supported by ASP.NET, whereas maxAllowedContentLength specifies the maximum length of content in a request supported by IIS. So you need to set both in order to upload large files: the smaller one "takes priority".

(我拿起这从 http://forums.iis.net/t/1169846.aspx - 信贷,这是由于)

(I picked this up from http://forums.iis.net/t/1169846.aspx -- credit where it's due.)

您可以同时设置通过编辑相应的web.config文件是本地一个网站内的特定网站,甚至一个文件夹。如果该文件(当然,要求)长度大于maxRequestLength的小于maxAllowedContentLength但更多的用户将得到你的标准(CSS)的错误页面,如果你有一个。如果是倒过来,他会得到一个IIS错误页面。出于这个原因,你可能希望有maxAllowedContentLength一个非常大的值(只是本网站/文件夹),然后让极限值是maxRequestLength的。

You can set both to be local to a specific site or even a folder within a site by editing the appropriate web.config file. If the file (well, request) length is less than maxAllowedContentLength but more than maxRequestLength, the user will get your standard (ASPX) error page, if you have one. If it's the other way around, he'll get an IIS error page instead. For that reason, you might want to have maxAllowedContentLength to a very large value (just for this website/folder) and then have the limiting value be maxRequestLength.

最后,记住了maxRequestLength是KB,而maxAllowedContentLength是以字节为单位!

Finally, remember that maxRequestLength is in KB whereas maxAllowedContentLength is in BYTES!

这篇关于其中获得优先权,或maxRequestLength的maxAllowedContentLength?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆