-1

I have one web service method it is taking long time to run. i want to make it asynchronous
and web service client should not wait for web method to complete. How i could implement this on c#.

//Web Method
[WebMethod]
public void StartProcess()
{
//long running method
}

//Web Client
webService.StartProcess();
niknowj
  • 977
  • 4
  • 19
  • 37

1 Answers1

0

Generate your service reference or edit it by choosing async option in VS, now the generation process will create two calls and one will be yourMethodAsync that you can call. You can also setup a callback this way. Also you can use parallel tasks in C# to put a call on a background thread. I prefer to generate the async methods since it is cleaner.

here is a post that will help

Community
  • 1
  • 1
chrislhardin
  • 1,747
  • 1
  • 28
  • 44