WCF endpoint extension not supported if param name present?

I am trying to extend the behavior of my service endpoint with the help of a special MessageInspector, the extension works fine and is selected, but only if I do not define the "name" parameter in the behavior tag and do not define a specific configuration situation on the endpoint. This means that I am expanding all the endpoints, and that is what I do not want. Can someone explain to me what I'm doing wrong?

This configuration does not support the myBehaviour extension and is not interrupted.

 <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 removal

 behaviorConfiguration="myBehaviour" 

and changing the behavior tag so that the name is not

  <behavior> <HeaderForwardExtension /> </behavior> 

works great.

thanks

+4
source share
1 answer

WCF doesn't seem to be taking your service and endpoint configuration. Probably because your contract attribute has a space. Thus, by default, WCF uses the default endpoint defined in the machine configuration file, which leads to the application of the default behavior. Check your service and contract names, make sure they match your code.

http://blogs.msdn.com/b/endpoint/archive/2009/06/30/service-configuration-improvements-in-net-4.aspx

0
source

All Articles