Failed to load file or assembly 'log4net, Version = 2.0.8.0, Culture = neutral, PublicKeyToken = 1b44e1d426115821' or one of its dependencies

I found several topics related to this problem, but none of them solved my problem.

I previously used log4net version 1.2.10.0 in my ASP.NET services. I updated it to the current version of log4net v2.0.8.0 , due to some third-party libraries I also added the following lines to web.config to support / redirect older 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> 

I am also confused in these posts by an Internal Exception: ((System.IO.FileLoadException) ex.InnerException.InnerException) .Message

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

Exception Message:

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

perhaps the following lines indicating a problem in FusionLog

WRN: comparing the assembly name led to a mismatch: PUBLIC KEY TOKEN ERR: Failed to complete the assembly setup (hr = 0x80131040). Study terminated

Full FusionLog

=== Information about pre-binding status === LOG: DisplayName = log4net, Version = 1.2.10.0, Culture = neutral, PublicKeyToken = 1b44e1d426115821 (Fully-specific) LOG: Appbase = file: /// F: / Cabin control System / CMS-localized / CMS-code / WebServices / CMSAPI / LOG: initial PrivatePath = F: \ Cabin control System \ CMS-localized \ CMS-code \ WebServices \ CMSAPI \ bin Call node: paypal_base, Version = 4.4.55.0 , Culture = Neutral, PublicKeyToken = b37401294aaf5617. === LOG: This binding begins with the default load context. LOG: Using the application configuration file: F: \ Cab Management System \ CMS-localized \ CMS code \ WebServices \ CMSAPI \ web.config LOG: Using the host configuration file: C: \ Users \ Dell \ Documents \ IISExpress \ config \ aspnet .config LOG: Using the machine configuration file from C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Config \ machine.config. LOG: Redirection found in application configuration file: 1.2.10.0 redirected to 2.0.8.0 . LOG: Post-policy link: log4net, Version = 2.0.8.0, Culture = neutral, PublicKeyToken = 1b44e1d426115821 LOG: Attempting to load a new URL File: /// C: /Windows/Microsoft.NET/Framework/v4.0.30319/Temporary Files ASP.NET/vs/864fb64d/ad78f51e/log4net.DLL. LOG: Attempting to load a new URL File: /// C: /Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET/vs/864fb64d/ad78f51e/log4net/log4net.DLL files. MAGAZINE: Attempting to load a new file URL: /// F: / Cab Management System / CMS-Localized / CMS-code / WebServices / CMSAPI / bin / log4net.DLL. PRPRZD: Comparison of the assembly name led to a mismatch: PUBLIC KEY TOKEN ERR: Failed to complete the assembly setup (hr = 0x80131040). palpation stops.

Sentence

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

Stack trace

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

Update

after a suggestion by Ciprian Lipan in the comments, I found this entry in .csproj in which the PublicKeyToken was different from my web.config . I copied this token and replaced it in config and received only the message with the exception, the internal exception disappeared. below is an 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> 

Exception

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

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

Fusionlog

=== Prebinding status information === LOG: DisplayName = log4net, Version = 1.2.10.0, Culture = neutral, PublicKeyToken = 1b44e1d426115821 (Fully set) LOG: Appbase = file: /// F: / Path / API / LOG: initial PrivatePath = F: \ path \ API \ bin Call node: paypal_base, Version = 4.4.55.0, Culture = neutral, PublicKeyToken = b37401294aaf5617. === LOG: This binding begins with the default load context. LOG: Using the application configuration file: F: \ path \ API \ web.config LOG: Using the host configuration file: C: \ Users \ me \ Documents \ IISExpress \ config \ aspnet.config LOG: Using the 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: Attempt to load a new URL File: /// C: /Windows/Microsoft.NET/Framework/v4.0.30319/ Temporary ASP.NET/vs/864fb64d/ad78f51e/log4net.DLL files. LOG: Attempting to load a new URL File: /// C: /Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET/vs/864fb64d/ad78f51e/log4net/log4net.DLL files. MAGAZINE: Attempting to load a new file URL: /// F: /path/API/bin/log4net.DLL. WRN: Comparison of the assembly name led to a mismatch: the main version of ERR: Failed to complete the assembly setup (hr = 0x80131040). palpation stops.

+5
source share
1 answer

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

Or you can return a link to the old version 1.2.10.0 with the old public key token. nuget log4net 1.2.10.0

+2
source

Source: https://habr.com/ru/post/1265598/


All Articles