applying-asynchronous-programming-c-sharp icon indicating copy to clipboard operation
applying-asynchronous-programming-c-sharp copied to clipboard

Avoid using Task.Run in ASP.Net Core

Open nimadir opened this issue 4 years ago • 0 comments

Hi dear filip

I have seen your video and in one wideo you said we should use Task.Run to convert a sync method to async version.

I have read this article : ASP.NET Core Performance Best Practices

In a paragraph has been said: Do not use Task.Run to make a synchronous API asynchronous.

I have ask a similar question in stackoverflow: Using Task.Run in ASP.Net Core

I'm confused and I want to know:

  1. How can I convert a sync method to async version in ASP.Net Core?
  2. If there is no async version of a method should we write sync web method?
  3. What is the best way to write async method?

Thanks

nimadir avatar Feb 04 '22 15:02 nimadir