[英]How to handle Transport and Communication level Exception in WCF?
I know that we can use FaultException and FaultContract to catch these exception? 我知道我们可以使用FaultException和FaultContract来捕获这些异常吗?
Is there any other way to (Except FaultException/FaultContract) catch specifically these two Exception (Transport and Communication)? 是否还有其他方法可以(捕获FaultException / FaultContract除外)专门捕获这两个异常(传输和通信)?
According to the Microsoft documentation, transport and communication errors are handled by the CommunicationException class. 根据Microsoft文档,传输和通信错误由CommunicationException类处理。
Communication errors occur when a network is unavailable, a client uses an incorrect address, or the service host is not listening for incoming messages. 当网络不可用,客户端使用错误的地址或服务主机未监听传入消息时,将发生通信错误。 Errors of this type are returned to the client as CommunicationException or CommunicationException-derived classes. 此类错误将作为CommunicationException或CommunicationException派生的类返回给客户端。
The following provides a good overview of the three categories of WCF errors: 以下内容很好地概述了WCF错误的三类:
https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-error-handling https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-error-handling
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.