Thursday, October 24, 2013

SharePoint 2013: Request Management

Yesterday I posted about the Distributed Cache and that I got frustrated with it. So I disabled it on one server. Turns out, it wasn't the smartest idea to simply shut the service down.  Yesterday night I saw a lot, and I mean A LOT!, errors like this one:

This does not sound good. I checked the Webapplications from the description, but they worked fine, as far as I can tell. Problem is the Service "Request Management", which is still running.
I stopped the service the service, did an IIS reset, waited a couple of minutes and checked the EventLogs again. I got one last message per Webapplication, like this one:

I'd say it works. If I encounter any more problems, I'll post on my blog and share this information. Until then my farm finally works without major issues.

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
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 ($ –eq $env:computername}
 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:
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:
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:
 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.

Wednesday, October 23, 2013

PowerShell: Get Certificates which are about to expired

I got a little error message in the EvenLog:
"Certificate for local system with Thumbprint XX  is about to expire or already expired."

And this is how I found the certificate:

Wednesday, October 16, 2013

SharePoint 2013: Change Distributed Cache Service Account

The code is simple:

$farm = Get-SPFarm
$cacheService = $farm.Services | where {$_.Name -eq "AppFabricCachingService"}
Write-Host $cacheService
$accnt = Get-SPManagedAccount -Identity "DOMAIN\ACCOUNTNAME"
Write-Host "Managed Account" $accnt
$cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser"
$cacheService.ProcessIdentity.ManagedAccount = $accnt
Write-Host "Now Updating"
Write-Host "Finished."

You will not need to use .Deploy() at the end, despite Microsoft using it.