C# webconfig maxRequestLength 中的属性是如何测量的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11438317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 17:51:41  来源:igfitidea点击:

How is the property in webconfig maxRequestLength measured

c#asp.netweb-config

提问by user710502

I would like to increase this value

我想增加这个值

 <httpRuntime maxRequestLength="2024000" executionTimeout="300"/>

But i am not sure how it is measured, MB, KB? not sure. I would like to be able to accept requests up to 50 MB.

但我不确定它是如何测量的,MB,KB?没有把握。我希望能够接受最大 50 MB 的请求。

Regards

问候

采纳答案by Adil

The property maxRequestLengthindicates the maximum file upload size supported by ASP.NET. This limit can be used to prevent denial of service attacks caused by users posting large files to the server. The size specified is in kilobytes. The default is 4096 KB (4 MB). MSDN

属性maxRequestLength指示 ASP.NET 支持的最大文件上传大小。此限制可用于防止由用户将大文件发布到服务器引起的拒绝服务攻击。指定的大小以千字节为单位。默认值为 4096 KB (4 MB)。MSDN

For 50 MB you will need to set it to 51200.

对于 50 MB,您需要将其设置为 51200。

<httpRuntime maxRequestLength="51200" executionTimeout="300"/>

Editbased on comments

根据评论编辑

The OP does not ask about executionTimeout but @barnes did in comments below. I feel to add some details about executionTimeoutas well which is other httpRuntimeattribute.

OP 没有询问 executionTimeout,但 @barnes 在下面的评论中做了。我想添加一些关于executionTimeout其他httpRuntime属性的细节。

executionTimeout:

执行超时

Optional TimeSpan attribute. Specifies the maximum number of seconds that a request is allowed to execute > before being automatically shut down by ASP.NET. This time-out applies only if the debug attribute in the compilation element is False. To help to prevent shutting down the application while you are debugging, do not set this time-out to a large value. The default is "00:01:50" (110 seconds), MSDN.

可选的 TimeSpan 属性。指定请求在被 ASP.NET 自动关闭之前允许执行的最大秒数。仅当编译元素中的 debug 属性为 False 时,此超时才适用。为帮助防止在调试时关闭应用程序,请勿将此超时设置为较大的值。默认为“00:01:50”(110 秒),MSDN

回答by Waqar Janjua

It accepts KB. For 50 MB, set it to

它接受 KB。对于 50 MB,将其设置为

maxRequestLength="51200"

回答by Chandan Y S

maxRequestLengthis measured in kilobytes

maxRequestLength以千字节为单位

maxAllowedContentLengthis measured in bytes

maxAllowedContentLength以字节为单位