title: Setting custom WCF-binding behaviour via .config file - why doesn't this work?
body: <p>I am attempting to insert a custom behavior into my service client, following the example <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.iclientmessageinspector.beforesendrequest.aspx" rel="nofollow noreferrer">here.</A></p>
  
  <p>I appear to be following all of the steps, but I am getting a <A href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationerrorsexception.aspx" rel="nofollow noreferrer">ConfigurationErrorsException</A>. Is there anyone more experienced than me who can spot what I'm doing wrong?</p>
  
  <p>Here is the entire app.config file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;system.serviceModel&gt;
          &lt;behaviors&gt;
              &lt;endpointBehaviors&gt;
                  &lt;behavior name="ClientLoggingEndpointBehaviour"&gt;
                      &lt;myLoggerExtension /&gt;
                  &lt;/behavior&gt;
              &lt;/endpointBehaviors&gt;
          &lt;/behaviors&gt;
          &lt;extensions&gt;
              &lt;behaviorExtensions&gt;
                  &lt;add name="myLoggerExtension"
                       type="ChatClient.ClientLoggingEndpointBehaviourExtension, ChatClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"/&gt;
              &lt;/behaviorExtensions&gt;
          &lt;/extensions&gt;
          &lt;bindings&gt;
          &lt;/bindings&gt;
          &lt;client&gt;
              &lt;endpoint
                  behaviorConfiguration="ClientLoggingEndpointBehaviour"
                  name="ChatRoomClientEndpoint"
                  address="http://localhost:8016/ChatRoom"
                  binding="wsDualHttpBinding"
                  contract="ChatRoomLib.IChatRoom"
                  /&gt;
          &lt;/client&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Here is the exception message:</p>
  
  <blockquote>
    <p>An error occurred creating the
    configuration section handler for
    system.serviceModel/behaviors:
    Extension element 'myLoggerExtension'
    cannot be added to this element. 
    Verify that the extension is
    registered in the extension collection
    at
    system.serviceModel/extensions/behaviorExtensions.
    Parameter name: element (C:\Documents
    and Settings\Andrew Shepherd\My
    Documents\Visual Studio
    2008\Projects\WcfPractice\ChatClient\bin\Debug\ChatClient.vshost.exe.config
    line 5)</p>
  </blockquote>
  
  <p>I know that I've correctly written the reference to the ClientLoggingEndpointBehaviourExtensionobject, because through the debugger I can see it being instantiated.</p>