Pinging WCF Services

wcf

Solution

The two things I do are a telnet check to make sure the WCF process has the socket open.

telnet host 8080

The second thing I do is always add an IsAlive method to my WCF contract so that there is a simple method to call to check that the service host is operating correctly.

public bool IsAlive() {
    return true;
}

Problem

What is the most efficient way to check if WCF Service is available. (Pinging) It suppose to be binding configuration independent. I prefer not to modify the Service Contracts with IsAlive() method. Ideally, I would expect that the WCF framework supports it. Otherwise, our solution is done by adding "ServiceAdministration" service, which is hosted in the same process as the above service. ServiceAdministration has a reference to the ServiceHost and it can check its State.

Original source