无法加载文件或程序集“log4net,Version=2.0.8.0,Culture=neutral,PublicKeyToken=1b44e1d426115821”或其依赖项之一

问题描述 投票:0回答:0

我发现了几个与此问题相关的线程,但没有一个解决了我的问题。

我之前一直在我的

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

<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).Message

无法加载文件或程序集“log4net”,版本=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' 或其之一 依赖关系。找到的程序集的清单定义不 匹配装配参考。 (HRESULT 异常:0x80131040)

异常消息:

无法加载文件或程序集“log4net”,版本=2.0.8.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' 或其之一 依赖关系。找到的程序集的清单定义不 匹配装配参考。 (HRESULT 异常:0x80131040)

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

WRN:比较程序集名称导致不匹配:PUBLIC KEY 令牌错误:无法完成程序集设置(hr = 0x80131040)。 探测终止

完整的FusionLog

===预绑定状态信息=== LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821 (完全指定)日志:Appbase = file:///F:/Cab Management 系统/CMS 本地化/CMS 代码/WebServices/CMSAPI/ 日志:初始 PrivatePath = F:\出租车管理 调用程序集中的 System\CMS-Localized\CMS-Code\WebServices\CMSAPI :paypal_base,版本=4.4.55.0,文化=中性, 公钥令牌=b37401294aaf5617。 === 日志:此绑定在默认加载上下文中启动。日志:使用应用程序配置文件:F:\Cab Management System\CMS-Localized\CMS-Code\WebServices\CMSAPI\web.config 日志:使用 主机配置文件: C:\Users\Dell\Documents\IISExpres

c# asp.net .net log4net .net-assembly
© www.soinside.com 2019 - 2024. All rights reserved.