2015-01-06 2 views
2

Google에서 검색했지만 해결책을 찾지 못했습니다. 캐시 관리자의 인스턴스를 만들려고하는데 예외가 발생합니다. 사용 엔터프라이즈 라이브러리 5.0. 나는 내 문제를 찾을 수 없습니다. 나는 완전히 붙어입니다. 어떤 힌트가 감지 할 수있다.ICacheManager 유형의 인스턴스를 가져 오는 동안 활성화 오류가 발생했습니다. "" "

ICacheManager cachManager = EnterpriseLibraryContainer.Current.GetInstance<ICacheManager>(); 

또는

var cm = CacheFactory.GetCacheManager("Cache Manager"); 

구성 정보를.

<configSections> 
    <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" /> 
</configSections> 

<cachingConfiguration defaultCacheManager="Cache Manager"> 
    <cacheManagers> 
    <add name="Cache Manager" type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="10000" numberToRemoveWhenScavenging="10" backingStoreName="NullBackingStore" /> 

    </cacheManagers> 
    <backingStores> 
    <add type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="NullBackingStore" /> 
    </backingStores> 
</cachingConfiguration> 
+0

구성이 web.config 또는 appName.exe.config에 배포되어 있습니까? 참조 : https://stackoverflow.com/questions/23987356/enterprise-library-exception-activation-error-occured-while-trying-to-get-insta 또는 https://stackoverflow.com/questions/6234076/activation- 시도 중 오류 발생 - 인스턴스 유형 - icachemanager-key –

답변

0

v. 5.0.414.0에서 5.0.505.0으로 업그레이드 할 때도 동일한 문제가있었습니다. 내 경우에는 다음을 호출하여 CacheFactory.GetCacheManager(..)을 호출하기 전에 실행해야하며 다시 확인해야했습니다.

 // first call this 
    Container.AddNewExtension<EnterpriseLibraryCoreExtension>(); 
    // and then 
    ICacheManager cacheManager = CacheFactory.GetCacheManager("Cache Manager"); 
관련 문제