How to verify if a WCF net.pipe endpoint address is valid in C#
I want to create a tool which would check the Endpoint ad开发者_如何学运维dresses defined in web.config file and validate if the address url of the WCF service is valid i.e service exists or not.
I am able to do it for http address but stuck on how to check the net.tcp address.
Can someone please help me on this?
The only way to check this is to call one of the methods on the endpoint.
If you want to do this, your service must have a specific method that you can call for this purpose. What I often do is have a method that returns the version information for a service, e.g.
[OperationContract]
public string GetVersion()
and I implement this on my services. To check whether the endpoint is OK, create a client-side proxy, and then call that method. If it works, then (and only then) your whole WCF setup is OK.
精彩评论