hi,
I just made one web API with core 9 with entity framework and all actions, i found that all the methods are made with a sync.
q1) so my question is where or how it can help me , because in my case i call my controllers action methods from java script in JavaScript i can can it in async or synchronous way, question came to my mind do i need async in the action methods of controller.
q2) and if i am not beneficial in above case then where i would be?
yours sincerely
Muhammad Imran AnsariPosted Jun 23, 2025, 2:28 PM
Use
asyncin Web API when performing I/O operations. it improves performance, scalability, and responsiveness under load.Q-1 Ans:
if your controller interacts with databases (like EF Core), external APIs, or file systems. Even though JavaScript can call your API asynchronously, using
asyncon the server frees up threads during I/O operations, allowing more requests to be handled efficiently.Q-2 Ans:
asyncprevents thread pool exhaustion and improves performance.Good Luck!
Howher MichaelPosted Aug 20, 2025, 1:24 PM
If you’re calling your controller methods from JavaScript, it usually makes sense to have async actions. Even if your JS can handle async or sync, making the controller async can help avoid blocking threads on the server when multiple requests come in.
rajesh yadavPosted Jun 28, 2025, 4:29 AM
thank u , is there any central configuration for a solution or project?
or i have to use as i have pased in above code.
rajesh yadavPosted Jun 24, 2025, 1:14 PM
in my case i have called a method of controller from javacript and method returns one table. so kindly explain this senario how i am getting benefited by async method raher than sync method of the controller ?