[英]WCF: Exception handling on OneWay OperationContract
I am having a WCF duplex service with Silverlight client and .NET 3.5 WCF service. 我正在使用Silverlight客户端和.NET 3.5 WCF服务的WCF双工服务。
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. 我的方案是:在双工推送OneWay操作从服务器到客户端如果在客户端通知处理程序中发生异常,则通道会出现静默故障,因此任何进一步的双工调用都会从服务器超时并失败。 (As explained here One-Way Operations and Exceptions ) (如此处所解释的单向操作和例外 )
My question(s): 我的问题:
FaultContract
a OneWay OperationContract
, wrap the exception on client and prevent faulting of the channel? 我可以使用FaultContract
装饰OneWay OperationContract
,在客户端包装异常并防止通道错误吗? When you use OneWay
OperationContract
, the receiver should not reply nor the sender of the request should expect one. 当您使用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. 您最好的选择是在客户端和服务之间创建另一个OneWay
OperationContract
,以便服务可以将故障发送给客户端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.