.netwcf.net-4.0wcf-extensions

WCF extensions execution order


If i have few WCF extension modules of same kind (like parameter inspector) can i be sure they're executed in the order i define them in the configuration file?

<system.serviceModel>
    <extensions>
        <behaviorExtensions>
            <add name="MyInspectorA" type="blabla" />
            <add name="MyInspectorB" type="blabla" />
        </behaviorExtensions>
    </extensions>
</system.serviceModel>

I need more guaranties than just my observations but can't find any confirmations on MSDN.


Solution

  • They'll be executed in the order they appear in the

    <system.serviceModel> <behaviors> <[service|endpoint]Behaviors> <behavior> <behavior_1 /> <behavior_2 /> <behavior_n /> </behavior> </[service|endpoint]Behaviors> </behaviors> </system.serviceModel>

    , not in the order listed in the behavior extensions.

    And service behaviors are called before endpoint behaviors - the order among the behaviors is described in http://blogs.msdn.com/b/carlosfigueira/archive/2011/03/16/wcf-extensibility-behaviors.aspx.