Solved

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

Posted on 2010-09-09
7
834 Views
Last Modified: 2012-05-10
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!
0
Comment
Question by:Anthony2000
  • 3
7 Comments
 
LVL 8

Author Comment

by:Anthony2000
ID: 33726339
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!
0
 
LVL 18

Expert Comment

by:DarrenD
ID: 33733152
0
 
LVL 8

Accepted Solution

by:
Anthony2000 earned 0 total points
ID: 33733851
I chose wsHttpBinding because it appeared to be the most interoperable binding. I cannot add callbacks because they are incompatible with my solution (according to MSDN). I may need to expose these web services to non dot-net applications.
I am currently pinging the server and this works, I was just thinking that it would be great if I could check the status of the underlying tcp connection (I have to check again and make sure that one is open for the entire time the service exists).
Thank you!
0
 
LVL 8

Author Closing Comment

by:Anthony2000
ID: 34118778
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.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question