Link to home
Start Free TrialLog in
Avatar of Anthony2000
Anthony2000Flag for United States of America

asked on

WCF service connectionstate does not change if the service provider exits.

I have an application that exposes several WCF service sessions. I have a client that consumes these services. If the server is shutdown, the client's session state is still reporting "opened". My current solution is to ping the server (by calling an exposed method in the service) and this seems to work.

My question: Is there some functionality already built into WCF where the client can be alerted if the service has been shutdown? or abnormally terminated? without having to call a method in the service to detect that it is gone? I tried testing the ConnectionState property, but it does not change (it continues to report opened). I am using wsHttpBinding.

Can someone shed some light? Do I need to enable some kind of feature?

Thanks in advance!
Avatar of Anthony2000
Anthony2000
Flag of United States of America image

ASKER

More information:
the classes that are exposed are decorated with:

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession, ConcurrencyMode:=ConcurrencyMode.Single)> _
and I am using "wsHttpBinding" as the service binding
Thanks!
Avatar of Darren
ASKER CERTIFIED SOLUTION
Avatar of Anthony2000
Anthony2000
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Since my solution is working, I am going to close this question. Anyone reading this will have to decide if they would like to research another solution. Maybe future releases of WCF will update the state of the connection at the time that the connection is broken.