开发者

Determining if a WCF net.tcp endpoint address is valid

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 ser开发者_Python百科vice 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜