简体   繁体   中英

error while upgrading to EL 5 'Microsoft.Practices.EnterpriseLibrary.Caching ..or one of its dependencies

I have tried to upgarde my Enterprise Library from 4.0.0.0 to 5.0.5.0

I knew the safe way was using NuGet.

I used it, but get this error:

An error occurred creating the configuration section handler for cachingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Configuration Error




Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 




Parser Error Message: An error occurred creating the configuration section handler for cachingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)




Source Error: 








Line 8:      <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
Line 9:      <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null" />
Line 10:     <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null" />
Line 11:     <section name="instrumentationConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.Configuration.InstrumentationConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null" />
Line 12:     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />




Source File: D:\MaM\Server\ClientServices\Dev\ClientService 1.5\Conduit.Mam.ClientService.Service\web.config    Line: 10 




Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null' could not be loaded.








=== Pre-bind state information ===
LOG: User = CONDUIT-IL\elad.bendavid
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///D:/MaM/Server/ClientServices/Dev/ClientService 1.5/Conduit.Mam.ClientService.Service/
LOG: Initial PrivatePath = D:\MaM\Server\ClientServices\Dev\ClientService 1.5\Conduit.Mam.ClientService.Service\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\MaM\Server\ClientServices\Dev\ClientService 1.5\Conduit.Mam.ClientService.Service\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/fb9f9038/ea6afb52/Microsoft.Practices.EnterpriseLibrary.Caching.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/fb9f9038/ea6afb52/Microsoft.Practices.EnterpriseLibrary.Caching/Microsoft.Practices.EnterpriseLibrary.Caching.DLL.
LOG: Attempting download of new URL file:///D:/MaM/Server/ClientServices/Dev/ClientService 1.5/Conduit.Mam.ClientService.Service/bin/Microsoft.Practices.EnterpriseLibrary.Caching.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

my web.config:

I have tried to see with NuGet, what dll dependent with what dll.

I verified and all of the dlls with the right versions are refrenced (installed by NuGet)

I tried DependenciesWallker, but couldn't understand what's missing.

You need to use the actual public key the assemblies were signed with. Just putting NULL will give you a mismatch and a failure to load.

I encountered this exception also. Turns out the configSections section in the web.config was referencing the 4.0 framework. Changing the section to this resolved it for me:

<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

Please add the ADO.NET entity model file again into the project. Dont delete the existing one. You just create one more .edmx file into the project. It will reference the new 5.0 version DLL files into the project and add the codes into the config file also. After adding the file you can delete the file from the project. It is only for adding the newly created reference into the project. Try this it will work....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM