Issue

We have multiple server farms and Distributed Cache should run on only one server on the farm. But when we run the Use-CacheCluster command on one of the SharePoint servers (which is not meant for Distributed Cache) we get the following error:

Use-CacheCluster : ErrorCode<ERRPS001>:SubStatus<ES0001>:Error in reading
 
provider and connection string values. Please provide the values manually.
 
At line:1 char:1
 
+ Use-CacheCluster
 
+ ~~~~~~~~~~~~~~~~
 
+ CategoryInfo : NotSpecified: (:) [Connect-AFCacheClusterConfiguration], DataCacheException
 
+ FullyQualifiedErrorId : ERRPS001,Microsoft.ApplicationServer.Caching.Com
 
mands.ConnectAFCacheClusterConfigurationCommand

Or if you run the Get:

Get-CacheHost : ErrorCode<ERRPS013>:SubStatus<ES0001>:Error: No valid cluster
 
settings were provided with Use-CacheCluster.
 
At line:1 char:1
 
+ Get-CacheHost
 
+ ~~~~~~~~~~~~~
 
+ CategoryInfo : NotSpecified: (:) [Get-AFCacheHostStatus], DataC
 
acheException
 
+ FullyQualifiedErrorId : Microsoft.ApplicationServer.Caching.DataCacheExc
 
eption,Microsoft.ApplicationServer.Caching.Commands.GetAFCacheHostStatusCommand

Cause

This error tells us that the server is unable to read and get the values of the Connection String. Basically, this information is coming from the AppFabric and If Distributed Cache service is not running on the server (where you ran the commands) then it will through the error. Because the server is unable to communicate to the AppFabric. In order to check on which server the Distributed Cache is running., you can do a couple of things.

PowerShell

Open the SharePoint PowerShell and run the below command:

Get-SPServiceInstance | Where {$_.Typename -like “Distributed Cache”}

Above command returns only one server on which DC is running, That is the problem.

Resolution

What we are seeing is as expected thing. But if you want to access the Distributed Cache from all servers in the farm then you have to enable the provision the DC instance on all server in the farm.

Now we have a couple of options to fix it.

Option # 1

No need to do anything, leave as is. In order to get this command working just log in on the server where Distributed Cache is running and run it.

Now, Let’s login on the server where we enabled the DC.


Open the PowerShell and run the following command:

Use-CacheCluster
 
Get-CacheHost

Option # 2

Install the Distributed Cache instance on all server in the farm and then stop it. It will look little ugly but it works.

Run the following command on the server where you want to run the DC.

add-SPDistributedCacheServiceInstance

The above command successfully provisions the Distributed Cache Service Instance on the server and starts the Service. Now run the below command.

stop-SPDistributedCacheServiceInstance -Graceful

This will stop the DC on the server, not remove it. Now if you run the

Use-CacheCluster
 
Get-CacheHost

As you see, DC is up on the server where we want it run and down on the server where we want it. But this looks ugly, as it is a big distraction.

Conclusion

It's recommended to remove the DC instance from the server where don’t want it to run to avoid confusion. Just keep it running on the server where it should be.