ASP.NET MVC和Ajax,并发请求? [英] ASP.NET MVC and Ajax, concurrent requests?

查看:110
本文介绍了ASP.NET MVC和Ajax,并发请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里AJAX新手!
目前在我的ASP.NET MVC web应用程序我的AJAX请求似乎越来越分批或排队,林不知道。
没有请求似乎得到完成,直到previous请求已完成。
我如何去获得的请求independantly回报?
我不必然希望有人给我答案,但也许一些链接好的教程或资源,可以帮助。谢谢

AJAX newbie here!
At the moment in my ASP.NET MVC web app my AJAX requests appear to be getting batched or queued, im not sure.
No requests seem to be getting completed until the previous request has finished.
How do I go about getting the requests to return independantly?
I dont necessarily want someone to give me the answer but maybe some links to good tutorials or resources which could help. Thanks

推荐答案

我扩大对拉克兰罗氏的答案,这是正确的。

I'm expanding on Lachlan Roche's answer, which is correct.

ASP.NET框架将是处理会话范围(一个全球性的资源),以prevent从另一个干扰一个请求单线程的请求。在的WebForms我想你可以使用Page指令指定单个页面不使用会话,因此不需要同步处理这样的。

The ASP.NET framework will "single-thread" requests that deal with Session scope (a global resource), to prevent one request from interfering with another. In WebForms I think you can use the Page directive to specify that individual pages don't use Session and therefore don't need to treated synchronously like this.

现在的问题是,在 ASP.NET MVC的所有请求使用会话,因为它是用来实现TempData的。您可以禁用会话状态完全,因为拉克兰罗氏指出的那样,或者你可以用这个对付对案件逐案的基础。

The problem is that in ASP.NET MVC all requests use Session, because it's used to implement TempData. You can disable session state entirely, as Lachlan Roche pointed out, or you can deal with this on a case-by-case basis.

一个可能的解决方案可能是脱掉你自己的后台线程来处理任何长时间运行code,使初始请求完成尽快。

A possible solution might be to kick off your own background threads to process any long-running code, so that the initial request "completes" as quickly as possible.

这篇关于ASP.NET MVC和Ajax,并发请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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