applying-asynchronous-programming-c-sharp
applying-asynchronous-programming-c-sharp copied to clipboard
Avoid using Task.Run in ASP.Net Core
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:
- How can I convert a sync method to async version in ASP.Net Core?
- If there is no async version of a method should we write sync web method?
- What is the best way to write async method?
Thanks