Async ASP.NET MVC 5 controller method I'm attempting to correctly convert a synchronous controller method to asynchronous, given that the operation it performs is CPU-intensive.

private MyDbContext db = new MyDbContext();
public async Task&lt;ActionResult&gt; Index()
{
    List&lt;DashboardItemViewModel&gt; viewModels = new List&lt;DashboardItemViewModel&gt;();
    List&lt;ProductModel&gt; products = db.Products.ToList();
    await Task.Run(() =&gt;
    {
        foreach (ClientModel client in db.Clients)
        {
            // Constructor uses lots of logic, mostly looping through the list
            //   many times
            viewModels.Add(new DashboardItemViewModel(client, products));
        }
    });
    return View(viewModels);
}
As a key area of concern with this code, you really should be passing a cancellation token here, as it is a long running operation.

You need to worry about the client giving up on the request, let's say they navigated to the URL and decided they didn't mean to. The operation will still continue to run until the thread operation is complete.

This kind of issue can also lead to all kinds of problems.

Note that this can also occur when there multiple requests (say an impatient user hits refresh frequently) or a lot of traffic.