I have a duplex WCF service. In the service contract, I have 3 async methods and 1 normal method (close session). In tha callback contract I only have 1 void method that is not async.
When I generate the proxy with svcUtil I use the /a paramter, and get the .cs. If I open the this file, I can see that is generated the Begin/end method for the no async method of the contract, I don’t know well why, because this methods is not marked as async in the contract. Anyway, this is no the problem.
The problem is with the method of the callback contract. In my client application, I implement the callback interface, but I have implemented one method, an sync method, so I have not the Begin/End methods. However, I can’t compile because I have an error, that the class that implement the callback interface does not implement the Begin/end methods.
Which is the problem?
Thanks.
Daimroc.
The class which implements the callback interface needs to implement the asynchronous methods as well (since they’re defined in the interface), but if an interface has both synchronous and synchronous versions of the same method, the synchronous one is invoked by default. In the code below, the asynchronous operations in the callback class just throw, but the code works just fine.