I am using ASP.NET Web Api with basic authentication.
My problem is that multiple API calls are not handled concurrently.
Let's say we call this simple method multiple times from a single machine with the same user credentials. If you run it 5 times in one second, the overall processing time will be 25 seconds instead of 5.
    [System.Web.Http.HttpGet]
    [System.Web.Http.Authorize(Roles = @"domain\group")]
    public string Test()
    {
        var startTime = DateTime.Now;
        System.Threading.Thread.Sleep(5000);
        var endTime = DateTime.Now;
        return $"{startTime} {endTime}";
    }
The answers to this question didn't help me:
I think it is because of the basic authentication.
I also tried changing the test method to async like this:
    [System.Web.Http.HttpGet]
    [System.Web.Http.Authorize(Roles = @"domain\group")]
    public async Task<string> Test()
    {
        var startTime = DateTime.Now;
        await Task.Run(() => {
            System.Threading.Thread.Sleep(5000);
        });
        var endTime = DateTime.Now;
        return $"{startTime} {endTime}";
    }
I also tried coloring the ApiController with [SessionState(SessionStateBehavior.ReadOnly)].
How can I achieve concurrent calls? Or should I change authentication to something else (must be connected to AD groups!)?
 
     
    