Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF ASync Method Not Called

I have a WCF service which is workng fine but I now want to make the calls to its method asynchronous. In VS2010, I have re-added the service reference in the client and selected the checkbox for async methods. However, now when I call MyMethodAsync() instead of MyMethod() nothing happens.

What am I doing wrong?

like image 447
Jonnster Avatar asked Feb 26 '26 04:02

Jonnster


1 Answers

You need to subscribe for the success callback. Here's an article on MSDN that shows an example:

client.MyMethodCompleted += new EventHandler<MyMethodCompletedEventArgs>(MyMethodCallback);
client.MyMethodAsync(parameters);

MyMethodAsync returns immediately and the MyMethodCallback function will be invoked once the operation completes and it will be passed as argument the result of the asynchronous operation.

like image 149
Darin Dimitrov Avatar answered Feb 28 '26 00:02

Darin Dimitrov