无法加载文件或程序集'log4net,Version = 2.0.8.0,Culture = neutral,PublicKeyToken = 1b44e1d426115821'或其依赖项之一 [英] Could not load file or assembly 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies

查看:298
本文介绍了无法加载文件或程序集'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 Messages Inner Exception: ((System.IO.FileLoadException)ex.InnerException.InnerException).Message

无法加载文件或程序集'log4net,版本= 1.2.10.0 , 文化=中性,PublicKeyToken = 1b44e1d426115821'或其中之一 依赖关系.找到的程序集的清单定义不 匹配程序集参考. (来自HRESULT的异常:0x80131040)

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)

异常消息:

无法加载文件或程序集'log4net,版本= 2.0.8.0 , 文化=中性,PublicKeyToken = 1b44e1d426115821'或其中之一 依赖关系.找到的程序集的清单定义不 匹配程序集参考. (来自HRESULT的异常:0x80131040)

Could not load file or assembly 'log4net, Version=2.0.8.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)

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

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

WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated

完成FusionLog

===预绑定状态信息=== LOG:DisplayName = log4net,Version = 1.2.10.0,Culture = neutral,PublicKeyToken = 1b44e1d426115821 (完全指定)日志:Appbase = file:///F:/Cab管理 系统/本地化的CMS/CMS代码/WebServices/CMSAPI/LOG:初始 PrivatePath = F:\ Cab管理 系统\ CMS本地化\ CMS代码\ WebServices \ CMSAPI \ bin调用程序集 :paypal_base,版本= 4.4.55.0,文化=中性, PublicKeyToken = b37401294aaf5617. === LOG:此绑定在默认的加载上下文中启动.日志:使用应用程序配置文件:F:\ Cab管理 系统\ CMS本地化\ CMS代码\ WebServices \ CMSAPI \ web.config日志:使用 主机配置文件: C:\ Users \ Dell \ Documents \ IISExpress \ config \ aspnet.config日志:使用 机器配置文件来自 C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config. 日志:在应用程序配置文件中找到重定向:1.2.10.0 重定向到2.0.8.0 .日志:政策后参考:log4net, 版本= 2.0.8.0,文化=中性,PublicKeyToken = 1b44e1d426115821日志: 尝试下载新的URL 文件:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/vs/864fb64d/ad78f51e/log4net.DLL.日志:尝试 下载新网址 文件:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/vs/864fb64d/ad78f51e/log4net/log4net.DLL.日志: 尝试下载新的URL文件:///F:/Cab管理 系统/本地化的CMS/CMS代码/WebServices/CMSAPI/bin/log4net.DLL. WRN: 比较程序集名称会导致不匹配:PUBLIC KEY TOKEN ERR:无法完成装配的设置(hr = 0x80131040).探测 终止.

=== Pre-bind state information === LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821 (Fully-specified) LOG: Appbase = file:///F:/Cab Management System/CMS-Localized/CMS-Code/WebServices/CMSAPI/ LOG: Initial PrivatePath = F:\Cab Management System\CMS-Localized\CMS-Code\WebServices\CMSAPI\bin Calling assembly : paypal_base, Version=4.4.55.0, Culture=neutral, PublicKeyToken=b37401294aaf5617. === LOG: This bind starts in default load context. LOG: Using application configuration file: F:\Cab Management System\CMS-Localized\CMS-Code\WebServices\CMSAPI\web.config LOG: Using host configuration file: C:\Users\Dell\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Redirect found in application configuration file: 1.2.10.0 redirected to 2.0.8.0. LOG: Post-policy reference: log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=1b44e1d426115821 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/864fb64d/ad78f51e/log4net.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/864fb64d/ad78f51e/log4net/log4net.DLL. LOG: Attempting download of new URL file:///F:/Cab Management System/CMS-Localized/CMS-Code/WebServices/CMSAPI/bin/log4net.DLL. WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

建议

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

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

堆栈跟踪

在com.paypal.sdk.profiles.BaseAPIProfile..ctor()在 com.paypal.sdk.profiles.ProfileFactory.createSignatureAPIProfile()
在PayPalLibrary.PayPalPayment.SetPaymentProfile(String rsUserName, 字符串rsPassword,字符串rsSignature,字符串rsEnviroment,字符串 rsIpAddress)在F:\ path \ Classes \ PayPalPayment.cs:第34行 API.ServiceBLL.DoCreditCardPayment(String txtNameOnCard,String ddlExpiryMonth,字符串ddlExpiryYear,字符串txtCardNo,字符串txtCv2, 字串金额,String& PaymentServiceType)中 F:\ Path \ ServiceBLL.cs:第2907行

at com.paypal.sdk.profiles.BaseAPIProfile..ctor() at com.paypal.sdk.profiles.ProfileFactory.createSignatureAPIProfile()
at PayPalLibrary.PayPalPayment.SetPaymentProfile(String rsUserName, String rsPassword, String rsSignature, String rsEnviroment, String rsIpAddress) in F:\path\Classes\PayPalPayment.cs:line 34 at API.ServiceBLL.DoCreditCardPayment(String txtNameOnCard, String ddlExpiryMonth, String ddlExpiryYear, String txtCardNo, String txtCv2, String amount, String& paymentServiceType) in F:\Path\ServiceBLL.cs:line 2907

更新

在评论了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

===预绑定状态信息=== LOG:DisplayName = log4net,Version = 1.2.10.0,Culture = neutral,PublicKeyToken = 1b44e1d426115821 (完全指定)LOG:Appbase = file:///F:/Path/API/LOG:初始 PrivatePath = F:\ path \ API \ bin调用程序集 :paypal_base,版本= 4.4.55.0,文化=中性, PublicKeyToken = b37401294aaf5617. === LOG:此绑定在默认的加载上下文中启动.日志:使用应用程序配置文件:F:\ path \ API \ web.config日志:使用 主机配置文件: C:\ Users \ me \ Documents \ IISExpress \ config \ aspnet.config日志:使用 机器配置文件来自 C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config. 日志:政策后参考:log4net,版本= 1.2.10.0, 文化=中性,PublicKeyToken = 1b44e1d426115821日志:尝试 下载新网址 文件:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/vs/864fb64d/ad78f51e/log4net.DLL.日志:尝试 下载新网址 文件:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/vs/864fb64d/ad78f51e/log4net/log4net.DLL.日志: 尝试下载新的URL文件:///F:/path/API/bin/log4net.DLL. WRN: 比较程序集名称会导致不匹配:主要版本 ERR:无法完成装配的设置(hr = 0x80131040).探测 终止.

=== Pre-bind state information === LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821 (Fully-specified) LOG: Appbase = file:///F:/Path/API/ LOG: Initial PrivatePath = F:\path\API\bin Calling assembly : paypal_base, Version=4.4.55.0, Culture=neutral, PublicKeyToken=b37401294aaf5617. === LOG: This bind starts in default load context. LOG: Using application configuration file: F:\path\API\web.config LOG: Using host configuration file: C:\Users\me\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/864fb64d/ad78f51e/log4net.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/864fb64d/ad78f51e/log4net/log4net.DLL. LOG: Attempting download of new URL file:///F:/path/API/bin/log4net.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

推荐答案

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'或其依赖项之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆