I have long-working sync controller method, and while it is running, I cannot get answers to other user requests.

I made everything async using async/await and ConfigureAwait(False), but I still need to wait.

Simple example:

    public async Task<ActionResult> Index()
    {
        var result = await Task.Run(() => Wait()).ConfigureAwait(false);// 

        return View(result);
    }

    private async Task<bool> Wait()
    {
        await Task.Delay(60000);

        return true;
    }

Now, if I send request to this method "mycontroller/Index", I expect that I can get View for another method "anotherController/Index", but I should wait while async method is completed.

Is it normal behavior? Should I use async to free ui thread and make it available while long-running method is completed?

Related posts

Recent Viewed