mikenlanggio
mikenlanggio

Reputation: 1137

Why does ASP.NET Core not process my requests in parallel?

I have a simple action like this:

[HttpGet]
public async Task<string> GetHtml()
{
    Console.WriteLine("Run=======================================================");
    await Task.Delay(5000);
    Console.WriteLine("End=======================================================");
    return "ok";
}

I open three windows quickly, and go to the URL. I expected the result to look like:

Run=======================================================
Run=======================================================
Run=======================================================
End=======================================================
End=======================================================
End=======================================================

But, It's not! Instead, the result was:

Run=======================================================
End=======================================================
Run=======================================================
End=======================================================
Run=======================================================
End=======================================================

In addition, when the first run is finished, the second request begins. Why?

Upvotes: 5

Views: 628

Answers (1)

Orkhan Alikhanov
Orkhan Alikhanov

Reputation: 10050

So as per my suggestion in the comment you tried with 3 different browsers and it worked as expected. So the issue was from the browser side. Browsers has their limits regarding how they manage connection to the same hostname. See other thread for more info

Upvotes: 6

Related Questions