开发者

AsyncController: Interference having 2 async methods

i'm having an AsyncController that has 2 AsyncMethods. One is called GetMessages, the other Check. It seems, that one call blocks the other, probably because both call this.AsyncManager.OutstandingOperations.Increment(); Do they share the same AsyncManager? What is the right way to do that? Do i have to have 2 AsyncController to ensure that they dont get in each other开发者_C百科s way?

Update: The code of both methods is similar to code posted here: Async operation completes, but result is not send to browser

in fact, it is the same controller, only added the Check/CheckCompleted. sometimes, the "Check" has to get triggered so that the "GetMessages" returns

Update2: I have a waittimout of 60 seconds for both methods. I reduced one now to 5, this helps it, but i think it is just a hack.


They shouldn't block. The blocking you are observing might be due to the fact that both methods use Session and because Session is not thread safe, ASP.NET blocks access if you have two parallel requests from the same session (for example AJAX requests).

So try disabling all session for those actions by decorating them with the following attribute:

[SessionState(SessionStateBehavior.Disabled)]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜