简体   繁体   English

ChannelFactory引发的WCF异常

[英]WCF Exceptions thrown by ChannelFactory

I'm connecting to a service and using a Channel created by ChannelFactory. 我正在连接到服务,并使用ChannelFactory创建的Channel。 I would like to know what exceptions can be thrown while invoking service interface's methods (for example if there is a service interface named ICalculator and I'm invoking its Add(5, 4)). 我想知道在调用服务接口的方法时会引发哪些异常(例如,如果有一个名为ICalculator的服务接口,而我正在调用其Add(5,4))。 I can't google the topic because i don't really know how to name the problem and what exactly i'm looking for. 我无法在Google上搜索该主题,因为我真的不知道该如何命名问题以及我到底在寻找什么。 I will be grateful for any link with that kind of information. 对于与此类信息的任何链接,我将不胜感激。

i mean exceptions about corrupted connection etc., not the exceptions specified by the creator of the service. 我的意思是有关损坏的连接等的例外,不是服务创建者指定的例外。

You can get: 你可以得到:

  • FaultException or derived class (FaultException<T>) if an unhandled exception is thrown by the service implementation. 如果服务实现引发未处理的异常,则返回FaultException或派生类(FaultException <T>)。

  • CommunicationException if an error occurs communicating with the service. CommunicationException如果与服务通信时发生错误。

There may be others but these are the ones you will typically handle. 可能还有其他一些,但是这些通常是您将要处理的。

I suspect just about any type of exception you care to throw. 我怀疑您想抛出的任何类型的异常。 Why would only certain exceptions be allowed? 为什么只允许某些例外?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM