2013-02-21 79 views
5

我试图从4.0.0.0 upgarde我的企业库到5.0.5.0错误,而升级到EL 5“Microsoft.Practices.EnterpriseLibrary.Caching ..或者它的一个依赖

我知道安全的方式是使用NuGet。

我用它,但得到这个错误:

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. 

我的web.config:

我试图看到的NuGet,什么DLL依赖什么DLL。

我验证和所有与正确版本的DLL文件都refrenced(由安装的NuGet)

我试过DependenciesWallker,但不明白什么遗漏。

+0

你看过由fuslogvw.exe生成的日志吗?它会为您提供更多有关未能加载的精确装配的详细信息。 (http://msdn.microsoft.com/en-us/library/e74a18c4(v=VS.100).aspx) – Jomit 2013-02-24 07:46:59

+0

还要检查DLL的PublicKeyToken和web.config中提到的那个。 (Microsoft.Practices.EnterpriseLibrary.Caching,版本= 5.0.505.0,文化=中立,PublicKeyToken = 31bf3856ad364e35) – Jomit 2013-02-24 07:53:32

+0

@Jomit如果我把我的web.config中的所有PublicKeyToken = null,它应该工作吗? – 2013-02-24 09:39:03

回答

4

你需要使用组件签名的实际公钥。只是将NULL放在一起会导致不匹配和加载失败。

+0

感谢你一千次! – Pascamel 2013-09-20 17:39:53

0

请将ADO.NET实体模型文件再次添加到项目中。不要删除现有的。您只需在项目中再创建一个.edmx文件。它会将新的5.0版本DLL文件引用到项目中,并将代码添加到配置文件中。添加文件后,您可以从项目中删除该文件。它仅用于将新创建的参考添加到项目中。试试这个吧......

1

我也遇到过这个异常。发现web.config中的configSections部分引用了4.0框架。更改部分为此解决了它对我来说:

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