WCF的ErrorHandler [英] WCF ErrorHandler

查看:96
本文介绍了WCF的ErrorHandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已看过一些单证有关建立自定义的ErrorHandler(由IErrorHandler继承)。不幸的是,我对如何做这件事的几个疑点。

I have read several documentations about building custom ErrorHandler (by inheriting from IErrorHandler). Unfortunately, I have several doubts about how doing it.

现在的问题是,我不完全理解IErorrHandler(即ProvideFault和的HandleError)的两种方法的含义。 对我来说,的HandleError用于处理异步逻辑(例如,登录)。但是,在这种情况下,为什么这个方法返回一个布尔值? 我还认为,其他方法可以用来确定误差是否应当被传播到客户机或别的东西。

The problem is that I don't exactly understand the meaning of the two methods of IErorrHandler (i.e. ProvideFault and HandleError). For me, the HandleError is used to process asynchronous logic (e.g. login). But, in this case, why does this method return a boolean? I also think that the other method can be used to determine whether an error should be propagated to the client or to something else.

难道我错了吗?

推荐答案

根据上的 MSDN文档,布尔是返回一个成功的执行所需的行为或失败。

Based on the MSDN documentation, the boolean is to return a success or failure of performing the needed behavior.

您是正确的,该ProviderFault方法是你控制什么是返回给客户端。

You are correct in that the ProviderFault method is where you control what is returned to the client.

我强烈建议你阅读链接的MSDN文档,它提供了一些很好的见解。

I highly recommend reading the linked MSDN doc, it provides some good insight.

这篇关于WCF的ErrorHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆