ASP.NET MVC and Ajax, concurrent requests?

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

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.

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.

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.

Leave a Comment