Microsoft Enterprise Library类型加载exception无法加载Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer

我正在尝试整理朋友服务。 基本上,一旦我在构造函数中启动它就会出错。 这是代码片段。

public class DefaultCacheManager : ICacheManager { private readonly Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager _cacheManager; public DefaultCacheManager() { //Code blows here _cacheManager = CacheFactory.GetCacheManager(); } 

我得到的错误如下。

未处理的exception:System.TypeInitializationException:’Test.TypeManagement’的类型初始值设定项引发exception。 —> Microsoft.Practices.Unity.ResolutionFailedException:依赖项的解析失败,type =“Test.DefaultCacheManager”,name =“CacheManager”。发生exception时:调用构造函数Test.DefaultCacheManager()。 例外情况是:TypeLoadException – 无法从程序集“Microsoft.Practices.EnterpriseLibrary.Common,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35”加载类型“Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer”。 – – – – – – – – – – – – – – – – – – – – – – – – 当时例外,容器是:

解析Test.DefaultCacheManager,CacheManager调用构造函数Test.DefaultCacheManager()—> System.TypeLoadException:无法从程序集’Microsoft.Practices.EnterpriseLibrary.Common,Version加载类型’Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer’ = 6.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35’。
在Microsoft.Practices.ObjectBuilder2上的test.DefaultCacheManager..ctor()中的Microsoft.Practices.EnterpriseLibrary.Caching.CacheFactory.InnerGetCacheManager(String cacheManagerName)位于c:\ Test \ CacheManager.cs:第12行,位于lambda_method(Closure,IBuilderContext) Microsoft.Practices.Unity.UnityContainer.DoBuildUp上的Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)中的Microsoft.Practices.ObjectBuilder2.BuildPrateStrategy.PreBuildUp(IBuilderContext context)上的.DynamicBuildPlanGenerationContext。 c__DisplayClass1.b__0(IBuilderContext context) (输入t,Object existing,String name,IEnumerable 1 resolverOverrides)
--- End of inner exception stack trace --- at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable
1 resolverOverrides)
--- End of inner exception stack trace --- at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable
1 resolverOverrides)
--- End of inner exception stack trace --- at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable
1 resolverOverrides)中(类型t,字符串名称,IEnumerable`1 resolverOverrides)在Microsoft.Practices.Unity.UnityContainerExtensions.Resolve [T](IUnityContainer容器,字符串名称,ResolverOverride []覆盖)位于c:\ Test \ TypeManagement.cs中的Test.TypeManagement.get_CacheManager() :在C:\ Test \ TypeManagement.cs中的Test.TypeManagement..cctor()的第56行:第36行—内部exception堆栈跟踪的结束—在Test.ThreadManager.Start的Test.TypeManagement.get_ServiceHost()中()在c:\ Test \ ThreadManager.cs中:第19行,位于c:\ Test \ Program.cs中的Test.Program.Main(String [] args):第14行

任何帮助和指导都会受到欢迎。

配置