Wcf - 3 retries before exception?

2020-02-29 10:38发布

问题:

I was asked to build a mechanism for 3 retries before generating a request exception.

We have this topology :

Service1 calls Service2.

If 3 times in a row has failed - generate an excpetion.

Is there any retry mechanism in WCF ?

回答1:

The WCF technology addressing this is Reliable Messaging. I think MaxRetryCount is the attribute you are looking for.

Here is an example with a custom binding using MaxRetryCount.