Niraj Singh

Niraj Singh

  • 1.8k
  • 43
  • 745

Getting concurrency in asp.net web api

Jul 20 2019 1:42 PM
Hi all,
I have written a asp.net web api and consuming from angular httpclient. A problem is being occured that the same api is called from different different source at the same time then the method that is being called from web api is being in concurrency.Here the method which is being called in web api is having large no of collection of data  which is being modified by other call without finish of first call.
How can handle it please do needfull.
Below is brief code details. 
 
[HttpPost]
[Route("api/getMenu")] 
public IHttpActionResult getMenu()
{
var result=_master.getMenu();
return OK(new {menu=result}); 
Here getMenu method have some custome code which is creating Dictionary object to return sometimes happening here first method is not released control then second call is also trying to modfy first one and error is being occur. 

Answers (1)