I have a WCF ServiceHost and I would like to determine if there are any clients connected to it.
It is inside a Console application, if that matters.
Or if there are events when a client connects or disconnects, that might be helpful too.
I have a WCF ServiceHost and I would like to determine if there are any clients connected to it.
It is inside a Console application, if that matters.
Or if there are events when a client connects or disconnects, that might be helpful too.
The best practice for WCF to have per-call services - so you won't really have "connected clients" - client calls in for a method call and then they're gone again.
WCF ServiceHost typically do not have clients that are connected for a longer period of time.
Also, the whole management side of things is a bit of a weak point in WCF up to now - with the advent of the "Dublin" server add-on this should improve. Microsoft is planning to ship Dublin as an add-on sometime after .NET 4.0 and VS2010 ship (probably early in 2010).
So for now - I don't think there's a whole lot you can find out, really. The sessions - if any - are on the transport level (in the case of NetTcpBinding) or there are reliable sessions, but I do not know any way to find those out on the server side, sorry.
Marc