1

a colleague of my said that a MVC 3 app handles all incoming requests one at a time.

So when i make two AJAX calls to my application from a webpage, asp.net MVC / IIS handles the first request first, then returns the result and then processes the second request.

He has this line of documentation from MSDN of evidence (http://msdn.microsoft.com/en-us/library/ee728598(v=vs.98).aspx)

You can use asynchronous action methods for long-running, non-CPU bound requests. This avoids blocking the Web server from performing work while the request is being processed

Where it says that 'asynchronous action methods' don't block, so 'normal' controller actions do.

He also said that he saw that in effect on his page ( in the browser debug tools, lokking at the request sent), that first ajax request one was processed, and then, even that it was fired at the same time as the first by the browser, the second.

I find it hard to believe that IIS can only serve one request at a time per application?

Michel
  • 23,085
  • 46
  • 152
  • 242
  • It depends. Look at:http://stackoverflow.com/questions/2672453/is-it-possible-to-tell-iis-7-to-process-the-request-queue-in-parallel – Avitus Sep 10 '12 at 11:29

1 Answers1

2

If you are on the same session, then AJAX queries will be serialized (one at a time).

You can change your controller to be sessionless. See What are some scenario's of having a Session-less Controller in ASP.NET MVC3?.

Community
  • 1
  • 1
Oded
  • 489,969
  • 99
  • 883
  • 1,009
  • Ok, i understand this, but this is per user. But when another user enters a request, is that also schedlued after mine? – Michel Sep 10 '12 at 11:41
  • @Michel - No. This scheduled behavior is per user, as you say. When doing AJAX calls with many users, these can happen at the same time for each user. – Oded Sep 10 '12 at 11:43
  • I'm realy surprised, i would not have guessed that requests for a user a serialized (one at a time). – Michel Sep 10 '12 at 12:03
  • @Michel - That's why I said. For each user the AJAX requests will be serialized (assuming the controller is using `Session`). – Oded Sep 10 '12 at 12:05
  • For future readers: This is not limited to AspnetMVC but is a WebForms functionality too. YMMV: For getting a new session open another browser or a new window in [porn mode](http://en.wikipedia.org/wiki/Privacy_mode). Note that the _session_ we talk about here is not the same as a logged in user. – LosManos May 06 '14 at 07:59