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

use*_*999 3 forms ajax asp.net-mvc upload file

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

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

似乎总是指向这段代码:

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

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

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

提前致谢

Dar*_*rov 11

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

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

    ...
</system.web>
Run Code Online (Sandbox Code Playgroud)

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

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

    ...
</system.webServer>
Run Code Online (Sandbox Code Playgroud)