AsyncFileUpload 文件大小限制

发布于 2024-09-16 19:46:17 字数 492 浏览 9 评论 0原文

当我使用AsyncFileUpload上传100KB图像时,没有收到错误消息,但图像未上传。我可以成功上传75KB的图片。我使用的是 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" />

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" />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

糖粟与秋泊 2024-09-23 19:46:17

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

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

  • 将 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

最后,虽然我不经常看到它,

  • 但如果有任何第三方网络监控软件,您应该确保它已正确配置为允许使用以下命令上传文件需要的长度和内容。

另外,stackoverflow 上还有另一个问题,该问题进入 如何配置 IIS 来处理非常大的文件上传?

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

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

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

  • 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:\Windows\System32\inetsrv\config\applicationHost.config and find the line:

    <section name="requestFiltering" overrideModeDefault="Deny" />
    
  • 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

  • If there is any third party network monitoring software you should ensure that it is properly configured to allow file uploads with the needed length and content.

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

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.

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.

唐婉 2024-09-23 19:46:17

当尝试在 IIS 6 上上传超过 200KB 的文件时,该文件可能永远不会上传,并且您会收到错误或被发送到空白屏幕。默认情况下,Windows 服务器将文件上传大小限制为大约 200KB。要克服此限制,您必须编辑 IIS metabase.xml 文件。

1.在编辑metabase.xml 文件之前,您必须告诉IIS 允许您编辑该文件。在 IIS 中,右键单击服务器名称并选择属性。选中“启用直接元数据库编辑”。

2.找到位于C:\windows\sytem32\inetserv 中的metabase.xml 文件并在记事本中打开该文件。

3.搜索AspMaxRequestEntityAllowed并增加值。默认值为 204800 (200K)。将值设置为 1000000 将允许上传 1 MB 的文件。

4.您现在可能希望取消选中名为“启用直接元数据库编辑”的 IIS 属性。

要增加文件下载大小限制,请重复上述所有步骤,但在步骤 3 中找到名为 AspBufferingLimit 的参数。默认下载限制为 4MB。

When trying to upload files over 200KB on IIS 6 the file may never upload and you either get an error or are sent to a blank screen. By default Windows server limits file uploads to about 200KB in size. To overcome this limit you must edit the IIS metabase.xml file.

1.Before you can edit the metabase.xml file you must tell IIS to allow you to edit the file. In IIS, right click the name of the server and select properties. Check "Enable Direct Metabase Edit".

2.Find the metabase.xml file located in C:\windows\sytem32\inetserv and open the file in Notepad.

3.Search for AspMaxRequestEntityAllowed and increase the value. The default value is 204800 (200K). Setting the value to 1000000 will allow 1 MB file uploads.

4.You may now wish to uncheck the IIS property called "Enable Direct Metabase Edit".

To increase the file download size limit, repeat all steps above but in Step 3 find the parameter called AspBufferingLimit. The default download limit is 4MB.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文