Solved

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

Posted on 2010-09-09
7
832 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now