I am hosting a WCF service inside of a WPF app. I would like the WCF to be able to communicate with its host. Specifically, I'd like to receive event notifications from the WCF when certain WCF methods are called by clients.
I've tried modifying my WCF to be a singleton like so:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public sealed class MasterNode : ServiceBase, IMasterNode
{
private static readonly MasterNode _instance = new MasterNode();
public static MasterNode Instance { get { return _instance; } }
private MasterNode()
{
}
static MasterNode()
{
}
and having the main form of the hosting WPF app using the Instance property to interact with the WCF, but this doesn't appear to work. It's almost as if the call from the client to the WCF is instantiating a new WCF. Help!