我正在使用Silverlight客户端和.NET 3.5 WCF服务的WCF双工服务.
我的方案是:在双工推送OneWay操作从服务器到客户端如果在客户端通知处理程序中发生异常,则通道会出现静默故障,因此任何进一步的双工调用都会从服务器超时并失败. (如此处所述One-Way Operations and Exceptions)
我的问题:
>我可以使用FaultContract装饰OneWay OperationContract,在客户端上包装异常并防止通道错误吗?
>如果没有,在从服务器双工推送期间捕获客户端上发生的异常会有什么其他方法?
解决方法
当您使用OneWay OperationContract时,接收方不应该回复,也不应该请求发送方.
- You can’t.
- Your best bet is you can create another
OneWay
OperationContract
between client and the service so that the service can send the fault to the client.