SharePoint 2013: Distributed Cache

Wow! I found my new enemy within the SharePoint world: Distributed Cache. Please step down from your throne, User Profile Service.

But how was that even possible?

Well, it started with a small, new SharePoint 2013 Farm, just enough power to run as a testing system. I wanted to use the Distributed Cache on the App as well as on the WFE. But everytime I tried to start the Service under /_admin/Server.aspx ( CA -> System Settings -> Manage services on server) I got this message:

So, what did I do? A lot. The next steps are the ones, that "fixed" my problem, which means, that I will not use Distributed Cache on my WFE but only on the App Server.

TechNet

suggests that I should repair the Cache and be done with. So I used their example:

$s = Get-SPServiceInstance GUID

$s.delete()

But that did nothing, except throwing a couple of errors. Maybe I got the GUID wrong, so I tried it without one:

$instanceName = "SPDistributedCacheService Name=AppFabricCachingService"

$serviceInstance = Get-SPServiceInstance | ? {( $_.service.tostring()) –eq $instanceName –and ($_.server.name) –eq $env:computername}

$serviceInstance.Delete()

 At least I didn't get an error. I checked id the ServerInstance was really removed:

Get-SPServiceInstance >> C:\Service.txt

Well. It's just the App Server there. And I'm honestly not sure if that is the way it's supposed to look like. But it would make sense, because I still have a ServerInstance running on my App Server. To be sure, that I don't have anything running, I'm trying to stop the service with this command:

Stop-SPDistributedCacheServiceInstance -Graceful

I'd say: I can't stop the ServiceInstance, because it does not exist. Which is great! It is gone, finally.

And now, we can remove the Service Instance:

Remove-SPDistributedCacheServiceInstance

I got no error message while writing this blogpost. When I was trying this before, I got a lot of errors, most of them were about "cachehostinfo is null".

If you check your CA now, you will notice, that the Distributed Cache Service was removed from the services on service page of the server, the WFE in my case.

Next step would be to add a ServiceInstance again, which you have to do with this code:

Add-SPDistributedCacheServiceInstance

Finally I got another error message, it's been a while. Also I'm starting to hate Distributed Cache.

I guess it's in use because of AppFabric. But why should that be a problem? Distributed Cache is based on AppFabric and as far as I know, you are not supposed to configure anything in AppFabric. So: what now?

In my case it meant to retrace my step, right to where I tried to add the ServiceInstance again.

After that, I tried all those links at the bottom. But none helped me with this problem. I tried for two days to get the Distributed Cache to work on my WFE, after that I gave up. I stop the ServiceInstance, removed the ServiceInstance and unregistered the WFE from the Cache:

Unregister-CacheHost -HostName 'HName' -Provider 'PName' -ConnectionString 'CString'

You can find the information for provider and connectionstring in the registry of the working server:

HKEY_LOCAL_MACHINE

-SOFTWARE

--Microsoft

---AppFabric

----v1.0

-----Configuration

Don't forget to do an IIS reset or you might get shocked from the IIS screen.

If anyone has a different solution, that is not one of the many posted below, please feel free to contact me!

And here are the

references

used, which are a lot. But sadly none of them fixed my problem.

http://summit7systems.com/cannot-remove-server-reference-from-farm-cachehostinfo-is-null/

http://mmman.itgroove.net/2013/07/fixing-the-appfabric-cache-cluster-in-sharepoint-2013/

http://stackoverflow.com/questions/7339772/getting-access-denied-trying-to-start-appfabric-cache-cluster-from-powershell

http://sharepoint.stackexchange.com/questions/55076/sharepoint-2013-distributed-cache-cachehostinfo-null

http://rakatechblog.wordpress.com/2013/02/04/sharepoint-2013-spdistributedcacheserviceinstance-cachehostinfo-is-null/

http://manojssharepointblog.wordpress.com/2013/05/29/start-and-stop-the-distributed-cache-service-in-sharepoint-2013/

http://rakatechblog.wordpress.com/2013/02/04/sharepoint-2013-unable-to-create-a-datacache/

http://gokanx.wordpress.com/2013/07/07/distributed-cache-appfabrikcache-on-sharepoint-server-2013-part-22/

http://www.peters.com/blog/Lists/Posts/Post.aspx?ID=76&AspxAutoDetectCookieSupport=1

http://www.jeremytaylor.net/2013/04/22/sharepoint-2013-distrbuted-cache-service/

http://blogs.msdn.com/b/besidethepoint/archive/2013/03/27/appfabric-caching-and-sharepoint-2.aspx

http://melcher.it/2013/02/cache-cluster-is-down-restart-the-cache-cluster-and-retry/

http://blog.idera.com/sharepoint/the-five-minute-cheat-sheet-on-sharepoint-2013s-distributed-cache-service/

SharePoint 2013: Request Management

PowerShell: Get Certificates which are about to expired