Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an example of checking on if a WCF Service is online? [duplicate]

Tags:

c#

wcf

I will have a client application using a proxy to a WCF Service. This client will be a windows form application doing basicHttpBinding to N number of endpoints at an address.

The problem I want to resolve is that when any windows form application going across the internet to get my web server that must have my web server online will need to know that this particular WCF Service is online. I need an example of how this client on a background thread will be able to do a polling of just "WCF Service.., Are You There?" This way our client application can notify clients before they invest a lot of time in building up work client-side to only be frustrated with the WCF Service being offline.

Again I am looking for a simple way to check for WCF Service "Are You There?"

like image 932
apolfj Avatar asked May 19 '10 16:05

apolfj


1 Answers

What this obsession with checking whether those services are there??

Just call the service and as any defensive programming course will teach you, be prepared to handle exceptions.

There's really no benefit in constantly sending "are you there?" requests all over the wire...

Even if you could have something like a Ping() method (that just returns a fixed value or something - your service name or whatever) - that only checks whether your service is reachable - what about the database you need to query to get data from? What about other services your service method depends on? It gets quite messy and very very tricky to figure out a way to check all that - just to see if it's there.

In brief: no, there is no reliable and meaningful way to check whether a given service is "there" and "alive" - just call it ! And be prepared to handle a failure - it will fail at times....

like image 102
marc_s Avatar answered Nov 15 '22 08:11

marc_s