Reputation: 1221
For a while, my team has been using a WCF service (self-hosted on wsHTTP binding), and an ASP website that communicates with it. All methods in the WCF service are called synchronously and without error from the website.
However, with the addition of a Windows Phone 8 application, a complication has been introduced: WCF methods cannot be called synchronously, they must be called asynchronously.The synchronous version of the methods are not available in WP8, even when no asynchronous method has been defined in WCF.
This introduces the challenge of consuming this wcf service without actually modifying the code of the service. Is this possible? If not, how would the WCF implementation be modified to support asynchronous method calls? And are there resources available that can help with this specific issue? I've been searching all afternoon but this seems like a very specific issue.
Any help is greatly appreciated.
Upvotes: 2
Views: 572
Reputation: 11858
Only the client call/code is asynchronous, the server operation call is still synchronous...
Client code:
var svc = new ServiceReference1.Service1Client();
svc.GetDataCompleted += (s, a) =>
{
MessageBox.Show(a.Result);
};
svc.GetDataAsync(42);
Server code:
[OperationContract]
public string GetData(int value)
{
return "hello world: " + value;
}
Maybe this article helps you:
Upvotes: 2