'RazorPage & mvc isn't async look like

public async Task OnGetAsync()
{
        _logger.LogInformation("begin");
        await Task.Delay(5000);
}

Get the page in the same time:

[11:32:05 INF] begin
[11:32:10 INF] begin

and ApiController is same. why not async look like?



Solution 1:[1]

According to your description, I guess you may use the same browser to test this action.

I suggest you could try to use different browser or private mode for the browser to test and you will find its async.

It depend on how the asp.net core handle the request, not related with async, but async will increase the web application performance.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1