Error by registering of custom behavior

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




During development of custom behavior you may get following error:

Extension element 'myEndpointBehaviorExtension' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.

Parameter name: element

To register the custom behavior the behavior extension which is of type BehaviorExtensionElement. Following configuration snippet has to be used:



<add name="myEndpointBehavior" type=" MyNamespace.MyEndpointBehaviorExtension, MyLibrary, Version=, Culture=neutral, PublicKeyToken=null" />




Additionally, the real behavior, which is in following example of type IEndpointBehavior, should be registerd as shown below:


<behavior name="some name">

<myEndpointBehavior />




However, if the extension section contains following configuration the configuration system will throw named exception:



<add name="myEndpointBehavior" type="MyNamespace.MyEndpointBehaviorExtension, MyLibrary" />



Be sure that the version of the assembly, culture and the public key are specified. Otherwise the initialization will fail.

Posted Jan 22 2007, 04:17 PM by Damir Dobric
Filed under: is a .Net Community Blog powered by daenet GmbH.