Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 尝试获取ICacheManager类型的实例时发生激活错误,密钥\"\&引用&引用;_C#_.net_Caching_Enterprise Library - Fatal编程技术网

C# 尝试获取ICacheManager类型的实例时发生激活错误,密钥\"\&引用&引用;

C# 尝试获取ICacheManager类型的实例时发生激活错误,密钥\"\&引用&引用;,c#,.net,caching,enterprise-library,C#,.net,Caching,Enterprise Library,我在谷歌上搜索过,但没有找到解决这个错误的方法。我正在尝试创建缓存管理器的实例,但遇到异常。我使用了企业图书馆5.0。我找不到我的问题。我完全卡住了。任何暗示都是值得注意的 ICacheManager cachManager = EnterpriseLibraryContainer.Current.GetInstance<ICacheManager>(); 配置信息 <configSections> <section name="cachingConfigur

我在谷歌上搜索过,但没有找到解决这个错误的方法。我正在尝试创建缓存管理器的实例,但遇到异常。我使用了企业图书馆5.0。我找不到我的问题。我完全卡住了。任何暗示都是值得注意的

ICacheManager cachManager = EnterpriseLibraryContainer.Current.GetInstance<ICacheManager>();
配置信息

<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");
//首先调用这个
Container.AddNewExtension();
//然后
ICacheManager cacheManager=CacheFactory.GetCacheManager(“缓存管理器”);

配置是部署在web.config还是appName.exe.config中?见:或
     // first call this
     Container.AddNewExtension<EnterpriseLibraryCoreExtension>();
     // and then
     ICacheManager cacheManager = CacheFactory.GetCacheManager("Cache Manager");