2
votes

Is it possible to catch an EndpointNotFoundException when calling an asynchronous method in WCF? I've wrapped the service call on my client in a try / catch block, and am catching EndpointNotFoundExceptions, FaultExceptions and general Exceptions, but if the service disappears once the client is running, no exception is caught on the async call, but eventually a timeout occurs.

What is the best way (or is there a way) to quickly catch a dead service during an async call?

2
Is this a similar question? (unfortuneatly not yet solved) stackoverflow.com/questions/1204534 - Simon Fox
It is similar, but SO's search didn't find it for me. Different keywords, obviously. - Darren Oster

2 Answers

1
votes

This has been open a while now with no action. I guess the answer basically is to set your timeout as low as possible given the network type / amount of processing expected / etc. One possibility is to set up one endpoint with a very short timeout (eg 5 seconds) with just a 'Ping' method as a heartbeat. Use the client to call and monitor this method periodically to get the health of the server / endpoint. As Simon Fox pointed out, check Where to trap failed connection on WCF calling class? for a more detailed response.

0
votes

I am also trying to handle these errors in a manageable way. Here's another thread that is about this subject.

WCF/C# Unable to catch EndpointNotFoundException