Im having a self-hosted WCF service in a WPF-app with a textbox for logging activity on the host.
First I used a Singleton-model, created my service-instance and attached a handler to a custom Message-event on my service-class so that activity on the service is logged to my textbox.
But now I need to use the PerSession-model so Im using the constructor with the Type-parameter instead. My question is how to get hold of any new sessions/service instances so that I can attach a handler to my Message-event in my service-class? Also I would like to list all active sessions on the host. How do I do any of this?
I found an example by Dan Rigsby (ObservableServiceHost) and I tried it out. But the problem Im having with this is that I cant get the service-instance in this event-handler beacuse the context is in a Opening-state and not Opened which seem to be required.
Any recommendations?