Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-09-09
7
Medium Priority
?
867 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

971 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