none
cannot rebuild distributed cache service

    Question

  • we've had SP 2013 up and running for about a year with no newsfeed issues. Today newsfeeds stopped working with the "internal error code 55". Nothing in the environment has changed. I have decided to try and rebuild the distributed cache service using the following code:

    Remove-SPDistributedCacheServiceInstance
    $SPFarm = Get-SPFarm
    $cacheClusterName = “SPDistributedCacheCluster_” + $SPFarm.Id.ToString()
    $cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
    $cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
    $instanceName =”SPDistributedCacheService Name=AppFabricCachingService”
    $serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
    $serviceInstance.Delete()
    Add-SPDistributedCacheServiceInstance

    however, when executing "serviceInstance.Delete()" I get an error saying it cannot run because of a null value (which I don't know where that is)

    Simply running

    Remove-SPDistributedCacheServiceInstance

    and

    Add-SPDistributedCacheServiceInstance

    deletes and re-creates the Distributed Cashe Service, but I'm fairly certain its not a clean rebuild, because it doesn't really solve anything.

    any help would be appreciated!

    Thursday, October 17, 2013 8:21 PM

Answers

  • their is one typo in my code, sorry for that

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

    $serviceInstance.delete()


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as answered & Vote helpful,if this solves/helps your problem.*

    Thursday, October 17, 2013 9:18 PM

All replies

  • your issue was not with the DC rather with UPS check this one http://www.justinkobel.com/post/2012/12/14/SharePoint-2013-Newsfeed-and-Distributed-Cache-Errors.aspx

    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.*

    Thursday, October 17, 2013 8:30 PM
  • sorry I may have deleted that bit of info by mistake in my OP but, I have already confirmed that my UPS has full control permissions to the Service Account that manages the DC

    Per this article:

    http://dayansameera.wordpress.com/2013/09/03/the-operation-failed-because-the-server-could-not-access-the-distributed-cache-sharepoint-2013/

    it mentions if permissions aren't fixing the issue, then rebuilding the DC may be necessary.

    Thursday, October 17, 2013 8:33 PM
  • what's the status of the DC, run these command and share the result.

    Use-CacheCluster

    Get-CacheHost 


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.*

    Thursday, October 17, 2013 8:39 PM
  • service is up, status is blank
    Thursday, October 17, 2013 8:48 PM
  • try this one 

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

    $s.delete()

    and now try to

    Add-SPDistributedCacheServiceInstance

    now again try to use cachecluster

    Use-CacheCluster

    Get-CacheHost 

    share the result

    HostName : CachePort    Service Name     Service Status  Version                                                                   

    --------------------   -----------        --------------   -------

    Name server:22233  AppFabricCachingService UP 3 [3,3] [1,3]


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.*

    Thursday, October 17, 2013 8:57 PM
  • same error I got with the previous code when running the delete command

    You cannot call a method on a null-valued expression.
    At line:1 char:1
    + $s.delete()
    + ~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull


    currently my cache-host status is as follows:

    HostName : CachePort  Service Name            Service Status Version Info
    --------------------  ------------            -------------- ------------
    servername:22233 AppFabricCachingService        UP             3 [3,3][1,3]

    Thursday, October 17, 2013 9:15 PM
  • their is one typo in my code, sorry for that

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

    $serviceInstance.delete()


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as answered & Vote helpful,if this solves/helps your problem.*

    Thursday, October 17, 2013 9:18 PM
  • ok the new code worked!

    my cache host status looks to be the same

    HostName : CachePort  Service Name            Service Status Version Info
    --------------------  ------------            -------------- ------------
    SERVERNAME:22233 AppFabricCachingService UP             3 [3,3][1,3]

    Thursday, October 17, 2013 9:23 PM
  • great, did it solve your issue with news feed?

    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as answered & Vote helpful,if this solves/helps your problem.*

    Thursday, October 17, 2013 9:28 PM
  • I went to test after I posted, still doesn't work. I went to view the services and it appears that the DC service is now stopped, I went to start it through the GUI and it wont start. I tried "$serviceInstance.Provision()" in powershell but it doesn't look like it's starting now.
    Thursday, October 17, 2013 9:29 PM
  • any error in the EVENT Log or ULS log?

    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as answered & Vote helpful,if this solves/helps your problem.*

    Thursday, October 17, 2013 9:31 PM
  • ran an iis reset and it seemed to get the service back up. my newsfeeds are up and running. I wish I knew what caused it, and why the initial code didn't rebuild, but after 6 hours of troubleshooting i'll take it! thanks!
    Thursday, October 17, 2013 9:39 PM
  • great, happy to see it resolved. IIS reset many time save us.

    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog *Please remember to mark your question as answered & Vote helpful,if this solves/helps your problem.*

    Thursday, October 17, 2013 9:41 PM
  • just realized after accessing the central admin that the DC service is being shown as "stopped", yet the newsfeeds work. i'm assuming the DC is in fact started even though it's showing as stopped in the GUI correct? is there something I can do to correct this?

    edit: nevermind. it went down again, and I started everything over from scratch and it's resolved.

    Thursday, October 17, 2013 9:48 PM