WCF:OneWay OperationsContract 上的异常处理
我有一个包含 Silverlight 客户端和 .NET 3.5 WCF 服务的 WCF 双工服务。
我遇到的情况是:在从服务器到客户端的双工推送 OneWay 操作期间,如果客户端通知处理程序中发生异常,通道会无提示地发生故障,因此来自服务器的任何进一步的双工调用都会超时并失败。 (正如此处所解释的单向操作和异常)
我的问题:
- 我可以吗只需用
FaultContract
装饰一个OneWay OperationContract
,将异常包装在客户端并防止通道出现故障? - 如果没有,还有什么其他方法可以捕获服务器双工推送期间客户端发生的异常?
I am having a WCF duplex service with Silverlight client and .NET 3.5 WCF service.
The scenario I have is: during the duplex push OneWay operation from server to client if an exception happens in client notification handler the channel gets silently faulted so any further duplex calls from server timeout and fail. (As explained here One-Way Operations and Exceptions)
My question(s):
- Can I just decorate with
FaultContract
aOneWay OperationContract
, wrap the exception on client and prevent faulting of the channel? - if not, what would be some other way to catch the exception which occurred on the client during the duplex push from server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用
OneWay
OperationContract
时,接收方不应回复,请求的发送方也不应期待回复。When you use
OneWay
OperationContract
, the receiver should not reply nor the sender of the request should expect one.