WCF:许多方法上的相同故障合同 [英] WCF: Same Faultcontract on many methods

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

问题描述

以一个项目为例,该项目有 10 个服务,每个服务有 20 个方法.

Take for example a project with 10 services and 20 methods on each service.

所有服务都继承自具有安全检查的基础服务.每个方法所做的第一件事就是调用安全检查.如果出现问题,这将引发安全异常.

All services inherit from a base services which has a security check. The first thing each method does is to make a call to the security check. This throws a security exception if there is a problem.

问题是:我需要在每个方法(OperationContract)上指定一个FaultContract,还是可以在中央定义中指定一次?

Question is: Do I need to specify a FaultContract on each method (OperationContract), or can I do it once in a central definition?

推荐答案

不,你需要对每个方法都这样做 - WCF 相当挑剔,几乎所有的东西都需要显式设置(这在最后,我深信不疑).

No, you need to do it on each and every method - WCF is rather picky and requires explicit settings pretty much for everything (which really is a good thing in the end, I am convinced).

马克

这篇关于WCF:许多方法上的相同故障合同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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