Not able to add WCF behavor extension to endpoint behaviors

2.7k Views Asked by At
<system.serviceModel>
  <extensions>
      <behaviorExtensions>
          <add name="WSDLFlatteningExtension" type="Thinktecture.ServiceModel.Extensions.Description,Thinktecture.ServiceModel.Extensions.Description,Version=1.0.0.0,Culture=Neutral,PublicKeyToken=f0de9a190a6d23d1"/>
      </behaviorExtensions>
  </extensions>
  <behaviors>
    <endpointBehaviors>
      <behavior name="WSDLFlatteningBehavior">
          <WSDLFlatteningExtension />
      </behavior>
    </endpointBehaviors>    
  </behaviors>
</system.serviceModel>

<WSDLFlatteningExtension /> line above is not recognized in my web.config. Throws an error at runtime. I have dropped the dll in C:\windows\Assembly and also in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE but nothing seems to be working.

4

There are 4 best solutions below

1
On BEST ANSWER

I was able to solve the issue. It was an issue with the dll I was referencing. I had to implement BehaviorExtensionElement in that class to make it available in configuration.

0
On

Yeah, the type= attribute looks wrong to me too. It should be something like type="Your.Full.Namespace.ClassName,Your.Assembly.Name,Version,Culture,PublicKeyToken".

Example from MSDN:

type="Microsoft.WCF.Documentation.EndpointBehaviorMessageInspector, HostApplication, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
0
On

Assuming the error is an AssemblyNotFoundException then you could try also adding a DependentAssembly reference to your config file so the framework can resolve the AssemblyName specified in type.

0
On

I suggest you check the type name specified in your type= attribute - it doesn't look right to me. You need to specify the fully qualified name of the IEndpointBehavior type you want to add.