.NET Framework Developer Center > .NET Framework Forums > Windows Communication Foundation (WCF) > ConfigurationErrorException in the BehaviorExtensionElement class

Answered ConfigurationErrorException in the BehaviorExtensionElement class

  • Tuesday, July 04, 2006 9:23 PM
     
     

     

    I am having a problem with migrating a service behavior extension from FebCTP to the JuneCTP version. The following is a configuration part of my service behavior extension. 

     <behaviors>
          <serviceBehaviors>
              <behavior name="myBehavior" >
                  <storage name="LocalStorage" />
              </behavior>
          </serviceBehaviors>
      </behaviors>

      <extensions>
         <behaviorExtensions>
             <add name="storage" type="StorageBehaviorElement, Storage"/>
         </behaviorExtensions>
      </extensions>

     

    After changes in my StorageBehaviorElement class such as using a BehaviorExtensionElement base clase, I am having the following error: 

    System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'storage' cannot be added to this element.  Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.
    Parameter name: element  ---> System.ArgumentException: Extension element 'storage' cannot be added to this element.  Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.

    It looks like my extension is not properly registered in the behaviorExtensions collection.

    Can anyone help? Thanks in advance.

     Roman

Answers

  • Wednesday, July 05, 2006 12:02 AM
     
     Answered

     

    I figured out (thanks to Reflector) this problem. The JuneCTP version requires to use an assembly qualified name. The following is a correct behaviorExtensions configuration:  

    <extensions>
     <behaviorExtensions>
       <add name="storage"
    type="StorageBehaviorElement, Storage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
     </behaviorExtensions>
    </extensions>

     

    Roman