我无法将故障 channel 的概念映射回某些绑定(bind)的手动实现。我认为这个 WCF 功能很烦人,我想知道是否有任何方法可以禁用它。
以 TCP 为例。大多数 TCP 通信都断开了。那么到底为什么一个连接会导致 channel 故障并断开所有以下连接呢?
和命名管道?
也许我错了。所以请解释为什么它是一个特性,而不是一个错误。
最佳答案
我认为它是 Juval Löwy(WCF 架构师之一)WCF 整体哲学的产物。引用他的书 Programming WCF Services:
This [the exception system and the normal way of using it] is a fundamental flaw of .NET as a platform. [...] Here [after an exception is thrown], something totally unexpected and horrible has happened. How could the client possibly pretend otherwise? The object may be hopelessly broken, and yet the client keeps using it.
这个想法是,毕竟,您正在与您正在使用的任何传输 channel 的另一端的对象进行通信,如果该对象抛出异常,它可能不再可用。这是一个有趣的观点,但我不确定我是否完全同意(因为,正如你所说,这在实践中可能会很烦人)。
关于.net - WCF channel 故障状态是否有帮助?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5145398/