抛出FaultException时,WCF通道重试5次

时间:2012-08-13 09:49:13

标签: c# wcf channelfactory faultexception

我正在使用DuplexChannelFactory而不是生成的代理创建WCF客户端频道。

对于特定方法,我在服务器端抛出一个已知的FaultException<MyFault>。我已根据需要使用[FaultContract(typeof(MyFault))]标记了服务界面。

在客户端,我抓住了这个FaultException<MyFault>并显示错误。

所有这一切都很好,但由于某种原因,WCF在将控制权返回给我的客户端代码之前重试了5次服务调用。这导致客户端明显延迟。

调试器在我的客户端代码中的服务调用上中断了5次,然后继续我的代码的下一行。我不能介入它,但调用堆栈显示在WCF内部被抛出的异常。

服务端的断点仅触发一次。

一旦控制权返回给我,通道就不会出现故障。

调试器输出显示:

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

这是正常行为吗?当我返回已知的预期错误时,为什么WCF会重试?

0 个答案:

没有答案
相关问题