AppFabric Cache Cluster Connection problem

One of my customers uses AppFabric as cache service for a IIS based web application. The AppFabric cache cluster was configured for high availibility and uses a SQL Cluster Instance as lead host. The configuration was made with PowerShell and without the AppFabric GUI setup application. Some times later I have to make some changes to the AppFabric cache cluster so I started the AppFabric PowerShell and it showed me the following message:

Use-CacheCluster : ErrorCode<ERRPS001>:SubStatus<ES0001>:Error in reading provider and connection string values. Please provide the values manually.

AppFabric Error Message

I have never seen this error before and I belive the reason is that I have configured all other AppFabric cache instance via the GUI Setup application. The GUI setup application writes the AppFabric connection string and the provider type to the following key in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppFabric\V1.0\Configuration

It sets the value "ConnectionString" to the connection string of the AppFabric SQL instance and the value "Provider" to "System.Data.SqlClient". Both entries were empty in my case:

AppFabric Connection String Key

I wrote the following PowerShell script to add the connection string to the registry:

$registryHive = "HKLM:SOFTWARE\Microsoft\AppFabric\V1.0\Configuration" $connectionStringValueName = "ConnectionString" $connectionStringValue= "Data Source=SQLServer\MyAppFabricInstance;Initial Catalog=AppFabric_Cache_Database;Integrated Security=True" $providerValueName = "Provider" $providerValue= "System.Data.SqlClient" if ((Test-Path $registryHive) -eq $false) { New-Item $registryHive -Force | Out-Null } Set-ItemProperty $registryHive -Name $connectionStringValueName -Value  $connectionStringValue| Out-Null Set-ItemProperty $registryHive -Name $providerValueName -Value $providerValue| Out-Null

After this change and a restart of the AppFabric PowerShell I was able to connect to the AppFabric cluster without any Problems.

Hint: It is also possible to provide the connection string and provider with the Use-CacheCluster cmdlet:

Use-CacheCluster -ConnectionString "Data Source=SQLServer\MyAppFabricInstance;Initial Catalog=AppFabric_Cache_Database;Integrated Security=True" -ProviderType System.Data.SqlClient