user101010101
user101010101

Reputation: 1659

Endpoint check for correctness

I have been searching the internet and have not been able to find a solution to my problem.

I want to be able to check the correctness and availability of a WCF service through a passed in endpoint. So the user inputs an endpoint (it changes a lot) and I want to be able to make sure it is valid by some form of ping or check.

I have been looking at MSDN but it does not seem to do what I am looking for.

Upvotes: 0

Views: 176

Answers (2)

Alex F
Alex F

Reputation: 3549

You could download excellent example from IDesign site (the writer of 'Programming WCF Services')

Here is the link: iDesign

Take a look on 'Ad-hoc Discovery' and 'Metadata Explorer'

Upvotes: 0

user1315124
user1315124

Reputation:

You could set the OpenTimeout of your clients binding to a reasonable short time and call your clients Open() method.

If the service is not there/answering, you will get a System.ServiceModel.EndpointNotFoundException. Or your service could implement a "Ping()" method, that gives you a sensible result you can check, and call this "Ping()" without calling Open() first. So you can check availability and correctness with one call.

Upvotes: 1

Related Questions