开发者

Not able to add WCF behavor extension to endpoint behaviors

开发者 https://www.devze.com 2023-02-20 22:52 出处:网络
<system.serviceModel> <extensions> <behaviorExtensions> <add name=\"WSDLFlatteningExtension\" type=\"Thinktecture.ServiceModel.Extensions.Description,Thinktecture.ServiceModel.Ext
<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>    
  <开发者_如何学C/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.


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.


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.


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消