I am creating a WCF client channel using DuplexChannelFactory
rather than a generated proxy.
For a particular method, I am throwing a known FaultException<MyFault>
on the server side. I have marked up the service interface with [FaultContract(typeof(MyFault))]
as required.
On the client side, I catch this FaultException<MyFault>
and display an error.
All this works absolutely fine, but for some reason WCF is retrying the service call 5 times before returning control to my client code. This is causing a noticeable delay on the client.
The debugger breaks 5 times on the service call in my client code before proceeding to the next line of my code. I cannot step into it, but the call stack shows the exception being thrown deep within WCF.
A breakpoint on the service side only fires once.
The channel is not faulted once control returns to me.
Debugger output shows:
A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in MyService.dll
Additional information: Fault Test
A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in System.ServiceModel.dll
Additional information: Fault Test
A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in System.ServiceModel.dll
Additional information: Fault Test
A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in System.ServiceModel.dll
Additional information: Fault Test
A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in System.ServiceModel.dll
Additional information: Fault Test
A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in mscorlib.dll
Additional information: Fault Test
Is this normal behaviour? Why is WCF retrying when I am returning a known expected fault?