Pregunta

I'm trying to find out why ASP.NET Development Server is not processing the requests concurrently.

So I've created a simple aspx page with the following code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

System.Threading.Thread.Sleep(10000)

End Sub

If I open the page two times, the response takes 20 seconds. That means, the server executes requests one by one (not concurrently).

Following advice provided in this topic, I've added EnableSessionState="false" to the page, but that doesn't seem to help.

Any ideas how to make the requests process concurrently?

¿Fue útil?

Solución

The asp.net dev server (cassini) cannot handle multiple threads. So it effectively processes requests one at a time. Turning session off really won't impact this.

It's really just for limited single user testing of a web app.

I'd recommend you dump cassini and install IIS Express or just go to the full IIS implementation.

A little reading: ASP.NET Dev Server (Cassini), IIS Express and multiple threads

Otros consejos

IIS on XP doesn't allow that many concurrent connections (I think it's 10). If you're developing in that environment, that may be why you're experiencing that (besides those 2 requests, you have requests for referenced files taking place, plus you may be issuing more requests than you think you are for that particular page).

I'm not sure if VS built-in server has similar limitations.

If you're using ASP.NET MVC without disabling SessionState (which by default you would be) your requests will be automatially serialized - so if you're checking for race conditions with a random Thread.Sleep() value then Request B will never complete before Request A even if the time slept for is less.

ASP.NET MVC and Ajax, concurrent requests?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top