How to access the service instance from host object in WCF?
- by user1048677
I am trying to incarnate some sort of ad hoc WCF service. I already managed to launch it and make it call its own web methods as some other guy's methods.
The issue that I am facing is instance management. I have set [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] so it now has a global instance with the same properties for all clients.
But besides that I need it to call other services of its kind while listening to incoming requests from clients (similar crazy services).
While debugging I noticed that the ServiceHost's constructor calls the constructor of the service class. So, I assumed it has access to the global instance of this class and I need to find a way to call methods of this instance.
Please don't ask what I have been smoking, I just have to make it ad hoc.