I have a WCF (4.0) service that is decorated as InstanceContextMode.Single and the class implementing the service is follows a Singleton pattern.
I first create the singleton instance of my service implementation with the Instance attribute. Then I pass this single instance to the constructor of ServiceHost rather than using the constructor with typeof() argument.
I can do Open() on the service, I can then do Close() and all is fine. But apparently on Close() it somehow disposes my singleton (???) because when I try again Open() on the same ServiceHost the ObjectDisposedException is thrown.
My service is hosted with NetTcpBInding in a Windows Form appplication.
Re-opening the same ServiceHost is not supported. You need to create a new ServiceHost.
ServiceHost implements the ICommunicationObject state machine. From Understanding State Changes:
When in the Closed state the object has essentially reached the end of the state machine. Once an object transitions from one state to the next, it does not go back to a previous state.