Invoking async operation viaChannelFactory
WCF supports asynchronous service operation invoking at the client side, which doesn't require the WCF service to be designed as asynchronous. When we use Visual Studio's Add Service Reference or .NET SDK's Svcutil.exe to generate the client proxy types, we can choose to generate asynchronous methods on the client proxy class (for each service operation). Then, how do we add asynchronous invoking support for a ChannelFactory
-based WCF client?
How to do it...
Add async style operation definition into the
ServiceContract
type (in the service client).As described in Use ChannelFactory to consume a WCF service recipe, we need to import the
ServiceContract
definition into our client application that needs to invoke the service operation viaChannelFactory
. And to make theChannelFactory
-based WCF client be able to invoke service operation asynchronously, the most important thing is adding the asynchronous pattern OperationContract into theServiceContract...