I have a wcf service hosted in a wpf application. I also have a multiple remote clients which are communicating with the service without any problems.
I want to know how to get hold of the service instance from WPF application.
I'm trying to use the IClientCallback
returned from OperationContext.Current.GetCallbackChannel<IClientCallback>()
to make a call to the operations on the client side when a button is pressed in the WPF application.
The InstanceContextMode = InstanceContextMode.Single
on the service side if this helps. Please show me through a code example as I'm new to WCF.
I figured it out by myself. I had to use the one of the overloaded constructors of servicehost and pass in the class holding the data contracts.
public ServiceHost(
object singletonInstance,
params Uri[] baseAddresses