arash Aghajani
arash Aghajani

Reputation: 21

How can I handle the the Endpoint not found Exception just one time (WCF)

As we know , when there was no connection between client and server, the Endpoint not found Exception will be created from WCF services ,

I d like to handle this error just one time and uses several times without several try catches for each WCF services please help me

Thanks

Upvotes: 2

Views: 1725

Answers (1)

flayn
flayn

Reputation: 5322

Wrap your server call in an Invoke method and handle the error there:

 public void Invoke(Action<T> call)
 {
    try
    {
       call();
    }
    catch(EndpointNotFoundException exception)
    {
    // handle here
    }
}

Upvotes: 1

Related Questions