gpt4 book ai didi

asp.net - 如何使ASP文件上传控件接受大文件?

转载 作者:行者123 更新时间:2023-12-02 07:39:26 25 4
gpt4 key购买 nike

我想使用 ASP FileUpload 控件上传文件。但是,如果我尝试将限制增加到大约 10000 kB,它不起作用并且仅接受最大 4 MB 的文件,并且我收到一条错误消息,指出与服务器的连接已重置。我提到:http://www.codeproject.com/KB/books/ASPNET20FileUpload.aspxhttp://msdn.microsoft.com/en-us/library/aa478971.aspx ,但是当我修改 web.config.comments 文件时,没有任何反应。我哪里出错了?

此外,我想知道当我将其部署到网络服务器上时它会如何工作。我这样问是因为在后面的代码中,我仍然为要上传文件的路径提供硬编码值。这是如何工作的?

最佳答案

<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="360"/>
</system.web>

这就是您正在寻找的东西。更改 web.config 文件中的 executionTimeout 属性。

根据this website ,

maxRequestLength - Attribute limits the file upload size for ASP.NET application. This limit can be used to prevent denial of service attacks (DOS) caused by users posting large files to the server. The size specified is in kilobytes. As mentioned earlier, the default is "4096" (4 MB). Max value is "1048576" (1 GB) for .NET Framework 1.0/1.1 and "2097151" (2 GB) for .NET Framework 2.0.

executionTimeout - Attribute indicates the maximum number of seconds that a request is allowed to execute before being automatically shut down by the application. The executionTimeout value should always be longer than the amount of time that the upload process can take.

关于asp.net - 如何使ASP文件上传控件接受大文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5936571/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com