I am trying to extend my service endpoint behaviour with custom MessageInspector, extension works fine and its picked up, but only if I don’t define the “name” parameter on behaviour tag and don’t define specific behaviorConfiguration on the endpoint. This means I am extending all endpoints and this is what I don’t want. Could anyone please explain me what am I doing wrong?
This config doesn't pick up myBehaviour
extension and doesn't fail.
<system.serviceModel>
<services>
<service name="testService">
<endpoint address="http://localhost:9999/TestServiceService"
binding="wsHttpBinding"
contract="ITestService "
behaviorConfiguration="myBehaviour"
/>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"
/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="myBehaviour">
<HeaderForwardExtension />
</behavior>
</endpointBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="HeaderForwardExtension" type="Test.Service.HeaderForwardBehavior, Test.Service, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
</system.serviceModel>
However removing
behaviorConfiguration="myBehaviour"
and changing behaviour tag so the name is not present
<behavior>
<HeaderForwardExtension />
</behavior>
works just fine.
Thank you