本文介绍了无法加载文件或程序集'log4net,Version = 2.0.8.0,Culture = neutral,PublicKeyToken = 1b44e1d426115821'或其依赖项之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了几个与此问题相关的主题,但是没有一个解决了我的问题.

I found several threads relating this issue, but none of those solved my issue.

我以前在ASP.NET服务中一直使用log4net version 1.2.10.0.由于某些第三方库,我已将其更新为当前版本log4net v2.0.8.0,我还在web.config中添加了以下几行以支持/重定向旧版本.

I have been previously using log4net version 1.2.10.0 in my ASP.NET services. I have updated it to current version which is log4net v2.0.8.0, due to some third party libraries I also added the following lines in my web.config to to support/redirect old versions.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
       <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-1.2.10.0" newVersion="2.0.8.0" />
      </dependentAssembly>
    </assemblyBinding>
</runtime>

我对这些消息也感到困惑内部异常:(((System.IO.FileLoadException)ex.InnerException.InnerException).消息

I am also confused in these MessagesInner Exception: ((System.IO.FileLoadException)ex.InnerException.InnerException).Message

异常消息:

可能以下几行指向FusionLog中的问题

完成FusionLog

建议

我是否需要将两个.dll都放在/bin文件夹中,

do I need to put both .dll in the /bin folder,

堆栈跟踪

更新

在评论了Ciprian Lipan的建议后,我在.csproj中找到了该条目,其中PublicKeyToken与我的web.config不同,我复制了此令牌并替换为config,只得到异常消息,内部异常消失了.波纹管是.csproj中的条目

after the suggestion of Ciprian Lipan in comments, I found this entry in .csproj in which PublicKeyToken was different from my web.config I copied this token and replaced in config and got only exception message, inner exception gone. bellow is entry in .csproj

<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
      <HintPath>packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
      <Private>True</Private>
</Reference>

例外

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=**1b44e1d426115821**' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

但是我用.csproj中的新令牌更改了config中的令牌

however I chnaged the token in config with new one found in .csproj

FusionLog

推荐答案

Apache决定更改其公共密钥arg!在此处类似的帖子中.

Apache decided to change their public key, arg! There is a solution in a similar post here.

或者您可以使用旧的公共密钥令牌将引用恢复为旧的1.2.10.0版本. nuget log4net 1.2.10.0

Or you could revert your reference to the older 1.2.10.0 version with the old public key token. nuget log4net 1.2.10.0

这篇关于无法加载文件或程序集'log4net,Version = 2.0.8.0,Culture = neutral,PublicKeyToken = 1b44e1d426115821'或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 01:55