Andre de Cavaignac

Let's blog it out...

WCF: ConfigurationErrorsException When Defining Behavior Extensions

Just a quick note:  There is a bug that looks like it won't be fixed for a while in the configuration of the <behaviorExtensions> section of the systm.serviceModel WCF configuration.  You may get the ConfigurationErrorsException when adding a new type of behavior (see below):

System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'myService' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.Parameter name: element (...\Service.exe.config line 43) ---> System.ArgumentException: Extension element 'wsdlNotice' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.

This is a known bug, but was not accepted by Microsoft as a bug.  See bug Microsoft feedback:
https://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=216431

To fix this issue, you will need to use the fully qualified type name, as shown in the sample below: 

<add name="myService"
type="Decav.FreeCode.MyServiceBehaviorElement,
Decav.FreeCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
/>

Leave a Comment

(required) 

(required) 

(optional)

(required)