views:

411

answers:

1

What do I do in order to fire an event when a new client connects to WCF-hosted service?

EDIT: What I'm looking is to get an event when a new session is created or new Channel gets created for a client. Such as: for session closure I'm using:

OperationContext.Current.Channel.Closed += new EventHandler( Channel_Closed );

so what should I be using for session iitiation?

A: 

Depends on your set up - do you do "per call" conversations? Then you don't really get any "client now connected" message per se....

Do you do session-based conversations? Your "ServiceHost" class has two events "Opening" and "Opened", which you can hook into, especially if you self-host your service.

What exactly is it you want to achieve by trapping this event?

Marc

marc_s
Session-based. Service host fires the Opened event when service host starts up, e.g.: on host.Open() call, not when new client connects
galets
do you have any advice if it's InstanceContextMode.Single?
arconaut