Configuration appfabric的配置设置

Configuration appfabric的配置设置,configuration,appfabric,Configuration,Appfabric,在使用应用程序结构时,我收到错误“ErrorCode:SubStatus:客户端配置文件中的错误” 当我尝试创建对象时,它会中断并抛出上述错误。 DataCacheFactory dcf=新的DataCacheFactory() 配置文件如下所示: <?xml version="1.0" encoding="utf-8" ?> <configuration> <!--configSections must be the FIRST element --> &l

在使用应用程序结构时,我收到错误“ErrorCode:SubStatus:客户端配置文件中的错误”

当我尝试创建对象时,它会中断并抛出上述错误。 DataCacheFactory dcf=新的DataCacheFactory()

配置文件如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!--configSections must be the FIRST element -->
<configSections>

<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient"
   type="Microsoft.Data.Caching.DataCacheClientSection,
   CacheBaseLibrary"
   allowLocation="true"
   allowDefinition="Everywhere"/>

<!-- required to read the <fabric> element, when present -->
<section name="fabric"
   type="System.Data.Fabric.Common.ConfigFile,
   FabricCommon"
   allowLocation="true"
   allowDefinition="Everywhere"/>
</configSections>

<!-- routing client -->
<dataCacheClient deployment="routing">

<hosts>
  <host
     name="servername"
     cachePort="22233"
     cacheHostName="DistributedCacheService"/>
</hosts>
</dataCacheClient>

<system.web>
<sessionState mode="Custom" customProvider="Velocity">
  <providers>
    <!-- specify the named cache for session data -->
    <add
      name="Velocity"
      type="Microsoft.Data.Caching.SessionStoreProvider"
      />
  </providers>
</sessionState>
</system.web>
</configuration>

您可能需要授予应用程序池对缓存服务器的身份访问权限。此帐户需要被授予访问AppFabric缓存的权限,客户端才能在ASP.NET中工作。这也适用于使用ASP.NET模拟时,缓存客户端仍将使用AppPool的标识来验证缓存客户端,而不是模拟帐户。

如果您未使用路由
deployment=“routing”
,则应删除。

是否已打开群集服务

我以前遇到过此消息,然后通过发出 在Appfabric的powershell中启动CacheCluster

之后,确保它已打开(您可以对端口22233(缓存端口的默认端口)上的“servername”执行telnet,并确保它已连接(包括此防火墙例外)


希望它对您的问题有帮助并且仍然有效:)

我尝试了您编辑的代码,它仍然给出了“错误代码:子状态:客户端配置文件中的错误”
DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1];
servers[0] = new DataCacheServerEndpoint("servername", 22233);

// Setup the DataCacheFactory configuration.
DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
factoryConfig.Servers = servers;

// Create a configured DataCacheFactory object.
DataCacheFactory mycacheFactory = new DataCacheFactory(factoryConfig);