1

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 others 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.

Community
  • 1
  • 1
esskar
  • 10,638
  • 3
  • 36
  • 57
  • it was all different. i noticed, that it did not block, but the request got not fired at all due to enabled ajax caching. $.ajaxSetup({ cache: false }); helped – esskar Jul 11 '11 at 15:31

1 Answers1

1

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)]
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • no, i use [SessionState(SessionStateBehavior.ReadOnly)] , so that should be fine. – esskar Jul 08 '11 at 18:16
  • @esskar, did you try disabling session totally? – Darin Dimitrov Jul 08 '11 at 18:17
  • no, but i already know that this wont be an option, since i have to read from it. – esskar Jul 08 '11 at 18:20
  • @esskar, well at least it might allow you to try to narrow down your problem, which is the first thing I try when I encounter some problem: try to narrow it down by removing parts of the code until I find the offending part. – Darin Dimitrov Jul 08 '11 at 18:39