Best Practices for ASP.NET Core
A common performance problem in ASP.NET Core apps is blocking calls that could be asynchronous. Many synchronous blocking calls lead to Thread Pool starvation and degraded response times. Do not block asynchronous execution by calling Task.Wait or Task<TResult>.Result . Do not acquire locks in common code paths. Do not call Task.Run and immediately await it - ASP.NET Core already runs app code on normal Thread Pool threads, so calling Task.Run only results in extra unnecessary Thread Pool scheduling. Do make hot code paths asynchronous. Do call data access, I/O, and long-running operations APIs asynchronously if an asynchronous API is available. Do not use Task.Run to make a synchronous API asynchronous. ...