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:
<extensions>
<behaviorExtensions>
<add
name="myEndpointBehavior"
type=" MyNamespace.MyEndpointBehaviorExtension, MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
Additionally, the real behavior, which is in following example of type IEndpointBehavior, should be registerd as shown below:
<endpointBehaviors>
<behavior
name="some name">
<myEndpointBehavior />
</behavior>
</endpointBehaviors>
</behaviors>
However, if the extension section contains following configuration the configuration system will throw named exception:
<extensions>
<behaviorExtensions>
<add
name="myEndpointBehavior"
type="MyNamespace.MyEndpointBehaviorExtension, MyLibrary" />
</behaviorExtensions>
</extensions>
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