1
votes

I am building a tool for validating if all the touchpoints (DB connection strings, mail servers, web services, WCF services, etc.) used by a set of applications are accessible after a disaster recovery migration to an off-site location.

The tool must check whether a given net.tcp endpoint address is valid and accessible, without generating a client proxy, and without regard to the binding or behavior used by the actual WCF client. The tool does not need to invoke any service method, and will only be run by system administrators using highly privileged domain credentials.

It is easy to do this for HTTP-based services:

hwrRequest = (HttpWebRequest)WebRequest.Create(i_WebServiceUrl);
hwrRequest.Timeout = i_nTimeoutSeconds * 1000;
hwrResponse = (HttpWebResponse)hwrRequest.GetResponse();
if (hwrResponse.StatusCode == HttpStatusCode.OK)
:
:

Is there an equivalent technique for WCF net.tcp services?

1

1 Answers

0
votes

First of all, why do you expect your WebRequest code to work? If the service isn't generating metadata, or is otherwise not responding to an HTTP GET verb, then your response will time out.

I recommend creating an administrative service contract and implementing it in all of your services. You may simply want to add a Ping() method to that contract, but you may also decide to add other methods.