Jonnster
Jonnster

Reputation: 3242

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?

Upvotes: 3

Views: 1298

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039438

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.

Upvotes: 3

Related Questions