.net 4 ws-discovery endpoints

458 views Asked by At

I am using ws-discovery in .NET 4.0 and it is working well. One question I have is how to deal with services that are not working. For example, say I have IService on server A and server B. Let's say this service on server A is broken (mimic this by stopping Application Pool). Your client will still find 2 services, so when you attempt to use the service you cannot guarantee that it is the working one.

So my question is, do you deal with this by looping through the endpoints and if the first one fails try the next one. Or is there a way to retrieve only services that are "up" at the time of the search? Or am I missing the point somewhere - quite possibly :-)

Thanks

2

There are 2 answers

0
MattC On

This article seems to cover what you are talking about by determining the endpoint address at runtime.

http://weblogs.asp.net/gsusx/archive/2009/02/13/using-ws-discovery-in-wcf-4-0.aspx

0
rocketsarefast On

I have found this to be a common problem in wcf discovery. A similar problem occurs when a server is sitting on two networks. The discovery will return both nic addresses, but of course, the client can only reach the server through one of these networks.

The workaround I have been using is to add a "void Ping()" function to the server. Then after discovery, the client tries to call this "Ping()" function on all discovered endpoints. The ones that return a response are good, others are bad.

I ended up taking this a step further and spawning a thread that continues to call this "Ping()" function occasionally. Then when a good server disappears, the thread removes that uri from a collection of 'good' uris.

I feel your pain.