加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 如何让ASP文件上传控件接受大文件?

发布时间:2020-12-16 06:45:34 所属栏目:asp.Net 来源:网络整理
导读:我想使用ASP FileUpload控件上传文件.但是,如果我尝试将限制增加到大约10000 kB,它将无法正常工作并接受最大4 MB的文件,并且我收到一条错误消息,指出已重置与服务器的连接.我提到: http://www.codeproject.com/KB/books/ASPNET20FileUpload.aspx和 http://m
我想使用ASP FileUpload控件上传文件.但是,如果我尝试将限制增加到大约10000 kB,它将无法正常工作并接受最大4 MB的文件,并且我收到一条错误消息,指出已重置与服务器的连接.我提到: http://www.codeproject.com/KB/books/ASPNET20FileUpload.aspx和 http://msdn.microsoft.com/en-us/library/aa478971.aspx,但是当我修改web.config.comments文件时,什么也没发生.我哪里错了?

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

解决方法

<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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读