How is the property in webconfig maxRequestLength measured

坚强是说给别人听的谎言 提交于 2019-12-18 14:09:11

问题


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.

Regards


回答1:


The property maxRequestLength indicates 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

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

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

Edit based on comments

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

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.




回答2:


It accepts KB. For 50 MB, set it to

maxRequestLength="51200"



回答3:


maxRequestLength is measured in kilobytes

maxAllowedContentLength is measured in bytes



来源:https://stackoverflow.com/questions/11438317/how-is-the-property-in-webconfig-maxrequestlength-measured

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!