jQuery的阿贾克斯要求阻止长时间运行的要求阿贾克斯 [英] jquery .ajax request blocked by long running .ajax request

查看:124
本文介绍了jQuery的阿贾克斯要求阻止长时间运行的要求阿贾克斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用jQuery的阿贾克斯的功能做一个进度条。

I am trying to use jQuery's .ajax functionality to make a progress bar.

一个请求通过阿贾克斯,这将启动长期运行的进程submited。一旦submited另一个阿贾克斯请求上调用它检查该过程的进展的间隔。然后一个进度表使用此信息进行更新。

A request is submited via .ajax, which starts a long running process. Once submited another .ajax request is called on an interval which checks the progress of this process. Then a progress meter is updated using this information.

不过,进度只有阿贾克斯调用返回一旦长时间运行的过程完成。它像它被封锁由最初的要求。

However, the progress .ajax call only returns once the long running process has completed. Its like its being blocked by the initial request.

奇怪的是这个过程中工作正常的开发,但未能在部署服务器上。我使用ASP.Net MVC在IIS上运行。

The weird thing is this process works fine on dev but is failing on the deployment server. I am running on IIS using ASP.Net MVC.

更新:很明显,这是因为它是工作的罚款在IE 7,但没有在IE 8的工作这很奇怪,因为IE 8允许最多宽带连接。6,其中IE 7只允许2请求相关的浏览器每个域。

UPDATE2:我认为这是一个局部问题,因为它出现另一个IE 8的机器上工作正常

推荐答案

服务器将只从每个用户一次运​​行一个页面。当您发送请求到得到进度状态,他们将被排队。

The server will only run one page at a time from each user. When you send the requests to get the progress status, they will be queued.

解决的办法是使返回状态无会话,使用 =的EnableSessionState假 @Page 指令。这样它不与任何用户相关联,因此,该请求不排队。

The solution is to make the page that returns the status sessionless, using EnableSessionState="false" in the @Page directive. That way it's not associated with any user, so the request isn't queued.

这当然意味着你不能使用会话状态从运行进程的线程获取状态线程沟通进展状态。您必须使用保存正在运行的进程的轨迹不同的方式,并与获得的地位,让你知道它来自哪个用户请求一起发送一些标识。

This of course means that you can't use session state to communicate the progress state from the thread running the process to the thread getting the status. You have to use a different way of keeping track of running processes and send some identifier along with the requests that gets the status so that you know which user it came from.

这篇关于jQuery的阿贾克斯要求阻止长时间运行的要求阿贾克斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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