开发者

WCF Unable to Load Custom Behavior Extension From Strongly Named Assembly

开发者 https://www.devze.com 2023-03-21 09:27 出处:网络
i have a custom behavior extension which i\'m using in my client side app.config <extensions> <behaviorExtensions>

i have a custom behavior extension which i'm using in my client side app.config

<extensions>
  <behaviorExtensions>
    <add name="consoleMessageTracing" type="Extensions.ConsoleMessageTracingElement, Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  </behaviorExtensions>
</extensions>

this works great, but if i move my custom behavior code into a project which is strongly named, and update the behavior like below:

    <add name="consoleMessageTracing" type="Common.WcfExtensions.ConsoleMessageTracingElement, Common.WcfExtensions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f7ac309eefe2c404" />

i get the following error:

SetUp : System.Configuration.ConfigurationErrorsException : The type 'Common.WcfExtensions.ConsoleMessageTracingElement, Common.WcfExtensions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f7ac309eefe2c404' registered for extension 'consoleMessageTracing' could not be loaded.

can anyone help explain what 开发者_运维问答i'm doing wrong? the token key is correct and the version of the assembly is correct.

UPDATE: if i use the WCF configuration editor, i get the same message. some reason its unable to read the DLL, the Common.DLL is in the bin directory.


OK so where do you deploy the strongly named assembly to? If it is in the GAC on the machine then it should find it there. If it is under your appbase then the first assembly ir finds with a matching DLL name (Common.WcfExtensions.dll) will be examined and if you happen to have one lying around that does not have the strong name then it will fail the load.

You could try using FusLogVw.exe to see what happens when it attempts to load the assembly - there's a guide to using it here

I've also found behavior extensions to be very sensitive to things like spaces in the name. Try removing and adding the spaces in various combinations

0

精彩评论

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

关注公众号