title: Why isn't my custom WCF behavior extension element type being found?
body: <p>I have a solution that contains two projects. One project is an ASP.NET Web Application Project, and one is a class library. The web application has a project reference to the class library. Neither of these is strongly-named.</p>
  <p>In the class library, which I'll call &quot;Framework,&quot; I have an endpoint behavior (an IEndpointBehavior implementation) and a configuration element (a class derived from BehaviorExtensionsElement). The configuration element is so I can attach the endpoint behavior to a service via configuration.</p>
  <p>In the web application, I have an AJAX-enabled WCF service. In web.config, I have the AJAX service configured to use my custom behavior. The system.serviceModel section of the configuration is pretty standard and looks like this:</p>
  <pre><code>&lt;system.serviceModel&gt;
   &lt;behaviors&gt;
    &lt;endpointBehaviors&gt;
     &lt;behavior name=&quot;MyEndpointBehavior&quot;&gt;
      &lt;enableWebScript /&gt;
      &lt;customEndpointBehavior /&gt;
     &lt;/behavior&gt;
    &lt;/endpointBehaviors&gt;
   &lt;/behaviors&gt;
   &lt;serviceHostingEnvironment aspNetCompatibilityEnabled=&quot;true&quot; /&gt;
   &lt;services&gt;
   &lt;service name=&quot;WebSite.AjaxService&quot;&gt;
    &lt;endpoint
             address=&quot;&quot;
             behaviorConfiguration=&quot;MyEndpointBehavior&quot;
             binding=&quot;webHttpBinding&quot;
             contract=&quot;WebSite.AjaxService&quot; /&gt;
    &lt;/service&gt;
   &lt;/services&gt;
   &lt;extensions&gt;
    &lt;behaviorExtensions&gt;
     &lt;add
         name=&quot;customEndpointBehavior&quot;
         type=&quot;Framework.MyBehaviorExtensionsElement, Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&quot;/&gt;
    &lt;/behaviorExtensions&gt;
   &lt;/extensions&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  <p>At runtime, this works perfectly. The AJAX enabled WCF service correctly uses my custom configured endpoint behavior.</p>
  <p>The problem is when I try to add a new AJAX WCF service. If I do Add -&gt; New Item... and select &quot;AJAX-enabled WCF Service,&quot; I can watch it add the .svc file and codebehind, but when it gets to updating the web.config file, I get this error:</p>
  <blockquote>
  <p>The configuration file is not a valid configuration file for WCF Service Library.</p>
  <p>The type 'Framework.MyBehaviorExtensionsElement, Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' registered for extension 'customEndpointBehavior' could not be loaded.</p>
  </blockquote>
  <p>Obviously the configuration is entirely valid since it works perfectly at runtime. If I remove the  element from my behavior configuration temporarily and then add the AJAX-enabled WCF Service, everything goes without a hitch.</p>
  <p>Unfortunately, in a larger project where we will have multiple services with various configurations, removing all of the custom behaviors temporarily is going to be error prone. While I realize I could go without using the wizard and do everything manually, not everyone can, and it'd be nice to be able to just use the product as it was meant to be used - wizards and all.</p>
  <p><strong>Why isn't my custom WCF behavior extension element type being found?</strong></p>
  <p>Updates/clarifications:</p>
  <ul>
  <li>It does work at runtime, just not design time.</li>
  <li>The Framework assembly is in the web project's bin folder when I attempt to add the service.</li>
  <li>While I could add services manually (&quot;without configuration&quot;), I need the out-of-the-box item template to work - that's the whole goal of the question.</li>
  <li>This issue is being seen in Visual Studio 2008. <strong>In VS 2010 this appears to be resolved.</strong></li>
  </ul>
  <p><a href="https://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=386511" rel="noreferrer">I filed this issue on Microsoft Connect</a> and it turns out you either have to put your custom configuration element in the GAC or put it in the IDE folder. They won't be fixing it, at least for now. I've posted the workaround they provided as the &quot;answer&quot; to this question.</p>