Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get list of word ducuments in a folder 10 36
Variable Event ? 3 23
Not seen Link button 5 17
Adding  DYMO Labelprinter to c# client application 4 8
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

15 Experts available now in Live!

Get 1:1 Help Now