【发布时间】:2015-03-04 15:26:10
【问题描述】:
我在谷歌搜索,但我没有找到解决该错误的解决方案。我正在尝试创建缓存管理器的实例,但出现异常。我使用的是企业库 5.0。我找不到我的问题。我完全被困住了。任何提示都是显而易见的。
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>
【问题讨论】:
-
配置是部署在web.config还是appName.exe.config?请参阅:stackoverflow.com/questions/23987356/… 或 stackoverflow.com/questions/6234076/…
标签: c# .net caching enterprise-library