大文件上的JQuery Ajax文件上传失败

时间:2022-04-23 03:20:52

I currently have a ASP.Net MVC web application that needs to upload large files using ajax. I am currently using this jQuery plugin - http://valums.com/ajax-upload/. I have also used this plugin - http://jquery.malsup.com but get the same result.

我目前有一个ASP.Net MVC Web应用程序,需要使用ajax上传大文件。我目前正在使用这个jQuery插件 - http://valums.com/ajax-upload/。我也使用过这个插件 - http://jquery.malsup.com但得到了相同的结果。

The issue that I am having for large file is that the iframe that gets generated to in order for the request to be asynchronous is not loading in time.

我对大文件的问题是,为了使请求异步而生成的iframe没有及时加载。

It always seems to point to this code:

似乎总是指向这段代码:

var doc = iframe.contentDocument ? iframe.contentDocument : iframe.contentWindow.document, response; 

For smaller files the script works great but for larger files the iframe nevers seems to get initialized properly.

对于较小的文件,脚本运行良好,但对于较大的文件,iframe nevers似乎正确初始化。

This has been driving me crazy. Can someone please HELP.

这让我发疯了。有人可以请帮助。

thanks in advance

提前致谢

1 个解决方案

#1


11  

You might need to increase the maximum allowed request size on the server as well as the execution timeout of the request using the <httpRuntime> section in your web.config

您可能需要使用web.config中的 部分增加服务器上允许的最大请求大小以及请求的执行超时。

<system.web>
    <httpRuntime 
        maxRequestLength="size in kbytes"
        executionTimeout="seconds"
    />

    ...
</system.web>

And if you are deploying your application in IIS 7.0+ you might also need to increase the maximum allowed request size using the <requestLimits> node of the <system.webServer> section:

如果要在IIS 7.0+中部署应用程序,则可能还需要使用 部分的 节点来增加允许的最大请求大小:

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="size in bytes" />
        </requestFiltering>
    </security>

    ...
</system.webServer>

#1


11  

You might need to increase the maximum allowed request size on the server as well as the execution timeout of the request using the <httpRuntime> section in your web.config

您可能需要使用web.config中的 部分增加服务器上允许的最大请求大小以及请求的执行超时。

<system.web>
    <httpRuntime 
        maxRequestLength="size in kbytes"
        executionTimeout="seconds"
    />

    ...
</system.web>

And if you are deploying your application in IIS 7.0+ you might also need to increase the maximum allowed request size using the <requestLimits> node of the <system.webServer> section:

如果要在IIS 7.0+中部署应用程序,则可能还需要使用 部分的 节点来增加允许的最大请求大小:

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="size in bytes" />
        </requestFiltering>
    </security>

    ...
</system.webServer>