gpt4 book ai didi

c# - 尝试获取 ICacheManager 类型的实例时发生激活错误, key \"\"“

转载 作者:太空宇宙 更新时间:2023-11-03 15:46:45 26 4
gpt4 key购买 nike

我在谷歌搜索但我没有找到解决该错误的解决方案。我正在尝试创建缓存管理器的实例但出现异常。我使用了 Enterprise library 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>

最佳答案

我从 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");

关于c# - 尝试获取 ICacheManager 类型的实例时发生激活错误, key \"\"“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27807522/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com