views:

35

answers:

1

Hi,

I am getting error "ErrorCode:SubStatus:Error in client configuration file." while working with app fabric.

When I try to create the object, it breaks and throws the above mentioned error. DataCacheFactory dcf = new DataCacheFactory();

The config file is as follows:

<?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>

Edit: If I use code to connect to AppFabric, it gives another error "ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified Cache servers are unavailable, which could be caused by busy network or servers. Ensure that security permission has been granted for this client account on the cluster and that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Retry later.)"

Code:

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);
A: 

You may need to grant your AppPool's identity access to the cache server. This account needs to be granted access to the AppFabric cache for the client to work in ASP.NET. This also applies when you are using ASP.NET impersonation, the cache client will still use the AppPool's identity to authenticate the cache client, not the impersonated account.

John Hann