SharePoint 2013 : How I fixed my corrupted AppFabric Cache Service

sharepoint2013 I have faced some troubles with Ditributed Cache… (again ?)
Especially when I tried to change the service account of the AppFabric Caching service, as explained here.
Then, my services seemed corrupted, it was impossible to restart them properly (Restart-CacheCluster command).
Their status was stuck on STARTING for a few minutes, and then went DOWN :

PS C:Userssp_admin> Use-CacheCluster
PS C:Userssp_admin> Get-CacheHost
HostName : CachePort Service Name Service Status
-------------------- ------------ --------------
Server1:22233 AppFabricCachingService DOWN
Server2:22233 AppFabricCachingService STARTING

And I had this error in the Windows Event logs (Event ID 1000 and 1001) – Seeing a failing KERNELBASE.dll module is not very reassuring !
This is what I have done to fix it. BEWARE that a corrupted distributed cache can result in resinstalling SharePoint from scratch ! So please be careful.
1- Stop all the SharePoint Distributed Cache service instances (on each WFE) :

Stop-SPDistributedCacheServiceInstance -Graceful

Use this code to force the uninstall :

Get-SPServiceInstance | ? {($_.service.tostring()) -eq "SPDistributedCacheService Name=AppFabricCachingService"} | % { $_.Server; $_.Status; $_.Id }
$s = Get-SPServiceInstance <GUID>

2- Unregister all hosts (on each WFE) :


3- Register all hosts :

Register-CacheHost -Provider "SPDistributedCacheClusterProvider" -ConnectionString "Data Source=DBAlias;Initial Catalog=SPServer2013_Config;Integrated Security=True;Enlist=False" -Account "DOMAINSP_DistributedCache" -CachePort 22233 -ClusterPort 22234 -ArbitrationPort 22235 -ReplicationPort 22236 -HostName Server1

  • The parameter « Account » must be the managed account that run the service (as displayed in the central administration).
  • The parameters « Provider » and « ConnectionString » must be copied from the following file « C:Program FilesAppFabric 1.1 for Windows ServerDistributedCacheService.exe.config »
  • The parameter « HostName » must be changed as well.

4- Start each cache host (on each WFE) :

Start-CacheHost -ComputerName Server1 -CachePort 22233

5- Restart all the servers
6- Create the SharePoint Service Instances (on each WFE) :


Everything went well then. These 2 commands showed me that the services were Online, and the AppFabric Services were marked as UP :

Get-SPServiceInstance | ? {($_.service.tostring()) -eq "SPDistributedCacheService Name=AppFabricCachingService"} | % { $_.Server; $_.Status; $_.Id }