如何配置IIS来处理真正大的文件上传?

时间:2021-03-09 01:59:09

Platform: IIS 6, ASP.Net 2.0 (.Net 3.5), Server 2003.

平台:IIS 6,ASP.Net 2.0(.Net 3.5),Server 2003。

I'm building an application that accepts files from a user, processes them, and returns a result. The file is uploaded using HTTP POST to an ASP.Net web form. The application is expecting some large files (hundreds of MB).

我正在构建一个接受用户文件,处理它们并返回结果的应用程序。使用HTTP POST将文件上载到ASP.Net Web表单。该应用程序需要一些大型文件(数百MB)。

I'm using SWFUpload to accomplish the upload with a nice progress bar, but that's not contributing to the issue, because when I bypass it using a standard HTML form pointing at my upload accepter page, I get the exact same error. When using the progress bar, the upload continues to 100%, then fails. With a standard form, the behavior appears to be the same.

我正在使用SWFUpload通过一个很好的进度条来完成上传,但这并没有导致这个问题,因为当我使用指向我的上传接受者页面的标准HTML表单绕过它时,我得到完全相同的错误。使用进度条时,上传继续为100%,然后失败。使用标准形式,行为似乎是相同的。

I'm having a problem right now uploading a file that's about 150MB. I've changed every settings I can find, but still no luck.

我现在正在上传一个大约150MB的文件。我已经改变了我能找到的所有设置,但仍然没有运气。

Here's a summary of what I've changed so far:

以下是我到目前为止所做的更改摘要:

In Web.config: Added this inside system.web:

在Web.config中:在system.web中添加了这个:

<httpRuntime executionTimeout="3600" maxRequestLength="1536000"/>

In machine.config: Inside system.web, changed:

在machine.config中:在system.web中,更改了:

<processModel autoConfig="true" />

to:

<processModel autoConfig="true" responseDeadlockInterval="00:30:00" responseRestartDeadlockInterval="00:30:00" />

and in MetaBase.xml: Changed:

并在MetaBase.xml中:已更改:

AspMaxRequestEntityAllowed="204800"

to:

AspMaxRequestEntityAllowed="200000000"

When the upload fails, I get a 404 error from IIS. My web form does not begin processing, or at least, it doesn't make it to the Page_Load event. I threw an exception at the beginning of that handler, and it doesn't execute at all on large files.

上传失败时,我从IIS收到404错误。我的Web表单没有开始处理,或者至少它没有进入Page_Load事件。我在该处理程序的开头抛出异常,并且它根本不在大文件上执行。

Everything works fine with smaller files (I've tested up to about 5.5MB). I'm not exactly sure what file size is the limit, but I know that my limit needs to be higher than 150MB, since this is not the largest file that the client will need to upload.

小文件一切正常(我测试了大约5.5MB)。我不确定文件大小是什么限制,但我知道我的限制需要高于150MB,因为这不是客户端需要上传的最大文件。

Can anyone help?

有人可以帮忙吗?

6 个解决方案

#1


5  

Urlscan was active on all websites, and has it's own request entity length limit. I wasn't aware that Urlscan was running on our server because it was a global ISAPI filter, not running on my individual website.

Urlscan在所有网站上都处于活动状态,并且拥有自己的请求实体长度限制。我不知道Urlscan正在我们的服务器上运行,因为它是一个全局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.

注意:要查找全局ISAPI筛选器,请右键单击IIS Admin中的“Web站点”文件夹,然后单击“属性”,再单击“ISAPI筛选器”选项卡上的“属性”。

#2


2  

When we ran into this issue we had to increase the buffer size limit according to this KB article: http://support.microsoft.com/kb/944886/en-us

当我们遇到这个问题时,我们不得不根据这篇知识库文章增加缓冲区大小限制:http://support.microsoft.com/kb/944886/en-us

I know this mentions ASP, but I believe it worked for ASP.NET as well.

我知道这提到了ASP,但我相信它也适用于ASP.NET。

Edit: Here is a link that might be more relevant to your issue and provide other options:
http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx

编辑:这是一个可能与您的问题更相关的链接,并提供其他选项:http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net的.aspx

#3


2  

(A note for googlers):

(针对googlers的说明):

For IIS7 add below to web.config (I added above <system.serviceModel>):

对于IIS7,请在下面添加到web.config(我在 上面添加):

<system.webServer>
        <security>
            <requestFiltering><requestLimits maxAllowedContentLength="262144000" /></requestFiltering> <!-- maxAllowedContentLength is in bytes. Defaults to 30,000,000 -->
        </security>
</system.webServer>

#4


1  

404 and missing Page_Load: IIS can only process the request once the complete POST is on the server. Therefore, if the POST fails (due to its size), it cannot fire the page's events.

404并缺少Page_Load:IIS只能在服务器上完成POST后处理请求。因此,如果POST失败(由于其大小),则无法触发页面的事件。

You might try NeatUpload http://www.brettle.com/neatupload. From the Manual: "By default, NeatUpload does not directly limit the size of uploads."

您可以尝试NeatUpload http://www.brettle.com/neatupload。从手册:“默认情况下,NeatUpload不会直接限制上传的大小。”

#5


0  

You can also try Velodoc XP Edition which has several advantages over NeatUpload including the fact that it uses ASP.NET Ajax extensions. See also the Velodoc web site for more information.

您还可以尝试Velodoc XP Edition,它比NeatUpload有几个优点,包括它使用ASP.NET Ajax扩展。有关更多信息,另请参阅Velodoc网站。

#6


0  

You say:

But 1536000 is only 1.5MB?

但1536000只有1.5MB?

#1


5  

Urlscan was active on all websites, and has it's own request entity length limit. I wasn't aware that Urlscan was running on our server because it was a global ISAPI filter, not running on my individual website.

Urlscan在所有网站上都处于活动状态,并且拥有自己的请求实体长度限制。我不知道Urlscan正在我们的服务器上运行,因为它是一个全局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.

注意:要查找全局ISAPI筛选器,请右键单击IIS Admin中的“Web站点”文件夹,然后单击“属性”,再单击“ISAPI筛选器”选项卡上的“属性”。

#2


2  

When we ran into this issue we had to increase the buffer size limit according to this KB article: http://support.microsoft.com/kb/944886/en-us

当我们遇到这个问题时,我们不得不根据这篇知识库文章增加缓冲区大小限制:http://support.microsoft.com/kb/944886/en-us

I know this mentions ASP, but I believe it worked for ASP.NET as well.

我知道这提到了ASP,但我相信它也适用于ASP.NET。

Edit: Here is a link that might be more relevant to your issue and provide other options:
http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx

编辑:这是一个可能与您的问题更相关的链接,并提供其他选项:http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net的.aspx

#3


2  

(A note for googlers):

(针对googlers的说明):

For IIS7 add below to web.config (I added above <system.serviceModel>):

对于IIS7,请在下面添加到web.config(我在 上面添加):

<system.webServer>
        <security>
            <requestFiltering><requestLimits maxAllowedContentLength="262144000" /></requestFiltering> <!-- maxAllowedContentLength is in bytes. Defaults to 30,000,000 -->
        </security>
</system.webServer>

#4


1  

404 and missing Page_Load: IIS can only process the request once the complete POST is on the server. Therefore, if the POST fails (due to its size), it cannot fire the page's events.

404并缺少Page_Load:IIS只能在服务器上完成POST后处理请求。因此,如果POST失败(由于其大小),则无法触发页面的事件。

You might try NeatUpload http://www.brettle.com/neatupload. From the Manual: "By default, NeatUpload does not directly limit the size of uploads."

您可以尝试NeatUpload http://www.brettle.com/neatupload。从手册:“默认情况下,NeatUpload不会直接限制上传的大小。”

#5


0  

You can also try Velodoc XP Edition which has several advantages over NeatUpload including the fact that it uses ASP.NET Ajax extensions. See also the Velodoc web site for more information.

您还可以尝试Velodoc XP Edition,它比NeatUpload有几个优点,包括它使用ASP.NET Ajax扩展。有关更多信息,另请参阅Velodoc网站。

#6


0  

You say:

But 1536000 is only 1.5MB?

但1536000只有1.5MB?