AsyncFileUpload 文件大小限制 [英] AsyncFileUpload file size limit

查看:34
本文介绍了AsyncFileUpload 文件大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 AsyncFileUpload 上传 100KB 图像时,我没有收到错误消息.但图像没有上传.我可以成功上传 75KB 图像.我使用的是 IIS 6.0.

When I was using AsyncFileUpload to upload 100KB image, I got no error message., but image not uploaded. I can upload 75KB image succssfully. I am using IIS 6.0.

    <cc1:AsyncFileUpload ID="afuImg" Width="400px" runat="server" 
UploaderStyle="Traditional" ThrobberID="Throbber2"  
    OnClientUploadError="uploadErrorImg" 
    OnClientUploadStarted="StartUploadImg" 
    OnClientUploadComplete="UploadCompleteImg" />

<httpRuntime maxRequestLength = "1024000" 
executionTimeout="54000" 
enableHeaderChecking ="false" />

推荐答案

您可以上传合并大小最大为 2GB 的文件,但这需要对您的应用程序配置文件进行一些修改.

You can upload files with a combined size of up to 2GB, but it requires some modifications in your application configuration files.

  • 将 httpRuntime 中的 ma​​xRequestLength 设置为 1024000000(最大 2GB,您已完成此操作)
  • 指定请求在被 ASP.NET 自动关闭之前允许执行的最大秒数.此设置的值在调试模式下会被忽略..NET Framework 2.0 中的默认值为 110 秒.要启用可能需要很长时间的大文件上传,请增加此属性.请参阅以下 MSDN 文章:http://msdn2.microsoft.com/en-我们/图书馆/e1f13641.aspx.
  • 打开文件 C:WindowsSystem32inetsrvconfigapplicationHost.config 并找到以下行:

  • set maxRequestLength in httpRuntime to 1024000000 (2GB max, you've done this)
  • Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET. The value of this setting is ignored in debug mode. The default in .NET Framework 2.0 is 110seconds. To enable large file uploads, which can take large periods of time, increase this property. See the following MSDN article: http://msdn2.microsoft.com/en-us/library/e1f13641.aspx.
  • Open the file C:WindowsSystem32inetsrvconfigapplicationHost.config and find the line:

<section name="requestFiltering" overrideModeDefault="Deny" />

  • 将 overrideModeDefault 属性设置为 Allow.
  • 可以在 machine.config 文件的元素中分配以下属性.它们必须在机器级别设置,而不是在 web.config 中的应用程序级别.
  • responseDeadlockInterval - 指定时间间隔,格式为 HH:MM:SS,如果在此时间间隔内没有响应,进程将重新启动.默认值为 3 分钟.要允许上传非常大的文件,您可能需要增加此值.
  • responseRestartDeadlockInterval - 以 HH:MM:SS 格式指定在上次重新启动以消除死锁之后必须经过的时间,然后才能重新启动进程以再次消除死锁.要允许上传非常大的文件,您可能需要增加此值.
  • AspMaxRequestEntityAllowed - 有时当应用程序托管在 Windows Server 2003 上时,上述设置似乎不起作用.在这种情况下,您必须修改 IIS 元数据文件,尤其是 AspMaxRequestEntityAllowed 属性.有关更多信息,请参阅:http://www.telerik.com/support/kb/article/b454K-gth-b454T-cee.aspx
  • Set the overrideModeDefault property to Allow.
  • The following attributes can be assigned in the element of the machine.config file. They must be set at the machine level, not the application level in web.config.
  • responseDeadlockInterval - Specifies the time interval, in the format HH:MM:SS, after which the process is restarted if there has not been a response during this interval. The default is 3 minutes. To allow very large uploads, you may have to increase this value.
  • responseRestartDeadlockInterval - Specifies the time, in the format HH:MM:SS, that must elapse after the last restart to cure a deadlock before the process is restarted to cure a deadlock again. To allow very large uploads, you may have to increase this value.
  • AspMaxRequestEntityAllowed - Sometimes when the application is hosted on Windows Server 2003, the above settings do not seem to have effect. In this case you must modify the IIS metadata file, particularly the AspMaxRequestEntityAllowed property. For more info see: http://www.telerik.com/support/kb/article/b454K-gth-b454T-cee.aspx
  • 最后虽然我不经常看到它

    Finally Though I don't see it very often

    • 如果有任何第三方网络监控软件,您应确保其配置正确,以允许上传所需长度和内容的文件.

    另外还有一个关于 stackoverflow 的问题,它进入了这个 如何配置 IIS 以处理非常大的文件上传?

    Also there is another question on stackoverflow which goes into this How do I configure IIS to handle really large file uploads?

    在上述问题中,答案 https://stackoverflow.com/a/206796/728841 列出了 Urlscan 作为问题是它有自己的请求实体长度限制.此人不知道 Urlscan 在服务器上运行,因为它是一个全局 ISAPI 过滤器,而不是在单个网站上运行.

    In the above question the answer https://stackoverflow.com/a/206796/728841 lists Urlscan being the problem it has it's own request entity length limit. The person was not aware that Urlscan was running on the server because it was a global ISAPI filter, not running on the individual website.

    注意:要找到全局 ISAPI 过滤器,请右键单击 IIS 管理中的网站文件夹,然后单击属性",然后单击ISAPI 过滤器"选项卡.

    Note: to locate global ISAPI filters, right click on the Web Sites folder in IIS Admin and click Properties, then on the ISAPI Filters tab.

    这篇关于AsyncFileUpload 文件大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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