How to access the service instance from host object in WCF?

Posted by user1048677 on Stack Overflow See other posts from Stack Overflow or by user1048677
Published on 2011-11-22T01:45:37Z Indexed on 2011/11/22 1:51 UTC
Read the original article Hit count: 148

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about wcf

Related posts about ad-hoc