How to call a WCF singleton service within a WCF singleton service without hanging?
Posted
by Michael Hedgpeth
on Stack Overflow
See other posts from Stack Overflow
or by Michael Hedgpeth
Published on 2010-04-13T19:28:22Z
Indexed on
2010/04/13
20:52 UTC
Read the original article
Hit count: 359
I have two services, one that calls another. Both are marked as singletons as follows:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple)]
public class Service : IService
And I set these up with a ServiceHost as follows:
ServiceHost serviceHost = new ServiceHost(singletonElement);
serviceHost.Open();
When the parent service tries to call the child service on the same machine, the parent service hangs, waiting for the child service.
I'm already considering moving away from the singleton model, but is there anything wrong with my approach? Is there an explanation for this behavior and a way out of it?
© Stack Overflow or respective owner