简体   繁体   English

Sync Framework异常处理为WCF故障

[英]Sync Framework exception handling as WCF faults

I am using WCF and Sync Framework to synchronize data between SQL 2008 and SQL Ce 3.5. 我正在使用WCF和Sync Framework在SQL 2008和SQL Ce 3.5之间同步数据。 I would like to only send well formed custom faults back to the client should something go wrong on the server. 如果服务器出现问题,我只想将格式良好的自定义故障发送回客户端。 However, the issue I am running into is when one of the Sync Framework methods is the source of the error, my fault is wrapped in a generic "Exception thrown by target of invocation" and returns to the client with the custom fault as the inner exception. 但是,我遇到的问题是当其中一个Sync Framework方法是错误的来源时,我的错误包含在一个通用的“调用目标抛出的异常”中,并以自定义错误作为内部返回给客户端例外。 As such, the client must catch the error as a generic Exception and then handle the inner exception. 因此,客户端必须将错误捕获为通用异常,然后处理内部异常。

How can I strip off the wrapper exception and just show the real error to the consumer of my service? 如何剥离包装器异常并向我的服务的使用者显示真正的错误?

连接自定义IErrorHandler以执行异常转换。

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

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