IIS, Asp.NET pipeline and concurrency

I am wondering how concurrency works in a web application. I have read several articles, and as far as I know, several instances of HttpApplication will work simultaneously. Now I created a simple web application for testing concurrency and placed the following in global.asax:

protected void Application_BeginRequest(object sender, EventArgs e)
{
    Response.Write("Request started: " + DateTime.Now);
    System.Threading.Thread.Sleep(10000);
    Response.Write("<br />");
    Response.Write("Request ended: " + DateTime.Now);
    Response.End();
}

I expected that if I go to the root of the web application on several browser tabs almost simultaneously, they will start and stop at the same time. However, it seems they do not. The start time of the second tab is the same as the first end time. Then I tested the same code in httpmodule or default.aspx page_load and got the same result.

What's going on here? Why are concurrent requests not running?

Edit: I put my understanding mainly in two articles:

http://msdn.microsoft.com/en-us/magazine/cc188942.aspx : " , , , HttpApplication."

http://www.code-magazine.com/article.aspx?quickid=0511061&page=5 aspx, , , " , ". Thread.Sleep

, -... ?

http://www.code-magazine.com/article.aspx?quickid=0511061&page=5

+2
3

, , HttpApplication. HttpApplication , . HttpApplication . ASP.NET 1.x , 20 . ASP.NET 2.0 .

ASP.NET, .

, , , , .

+3

. Google Chrome. , , URL-, , !

, !

+3

Why don't you change the pattern to print the stream identifier? This will tell you if multiple thread requests will be executed at the same time. I am sure that this is so.

+1
source

Source: https://habr.com/ru/post/1710323/


All Articles