Snehit
Snehit

Reputation: 43

What is the order of execution of the endpoint behaviors in WCF?

What is the order of execution of the endpoint behaviors in 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>

Upvotes: 4

Views: 1138

Answers (1)

Cybermaxs
Cybermaxs

Reputation: 24556

From MSDN

Evaluation Order

The System.ServiceModel.ChannelFactory and the System.ServiceModel.ServiceHost are responsible for building the runtime from the programming model and description. Behaviors, as previously described, contribute to that build process at the service, endpoint, contract, and operation.

The ServiceHost applies behaviors in the following order:

Service

Contract

Endpoint

Operation

Within any collection of behaviors, no order is guaranteed.

The ChannelFactory applies behaviors in the following order:

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

Upvotes: 4

Related Questions