简体   繁体   English

WCF中端点行为的执行顺序是什么?

[英]What is the order of execution of the endpoint behaviors in WCF?

What is the order of execution of the endpoint behaviors in WCF ? WCF中端点行为的执行顺序是什么? I want the logging to happen only if the request passes the validation block. 我希望只有在请求通过验证块时才会发生日志记录。 But in my case, even though the validation fails, the requests are logged by the auditing interceptor. 但就我而言,即使验证失败,审计拦截器也会记录请求。

I have two behavior extensions: 我有两个行为扩展:

<behaviorExtensions>
<add name="validation"/>
<add name="Auditing"/>
</behaviorExtensions>

and then in my behaviors: 然后在我的行为中:

<behaviors>
<endpointBehaviors>
<validation ruleset"AuthenticationRuleSet"/>
<Auditing />
</endpointBehaviors>
</behaviors>

From MSDN 来自MSDN

Evaluation Order 评估订单

The System.ServiceModel.ChannelFactory and the System.ServiceModel.ServiceHost are responsible for building the runtime from the programming model and description. System.ServiceModel.ChannelFactory和System.ServiceModel.ServiceHost负责从编程模型和描述构建运行时。 Behaviors, as previously described, contribute to that build process at the service, endpoint, contract, and operation. 如前所述,行为有助于服务,端点,合同和操作的构建过程。

The ServiceHost applies behaviors in the following order: ServiceHost按以下顺序应用行为:

Service 服务

Contract 合同

Endpoint 端点

Operation 手术

Within any collection of behaviors, no order is guaranteed . 在任何行为集合中, 不保证订单

The ChannelFactory applies behaviors in the following order: ChannelFactory按以下顺序应用行为:

Contract 合同

Endpoint 端点

Operation 手术

Within any collection of behaviors, again, no order is guaranteed . 在任何行为集合中,再也没有保证订单

For validation purposes, maybe you should take a look at Message Inspectors 出于验证目的,您可能应该查看Message Inspectors

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

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