Sitecore 9 Installation: xConnect Services Won't Start

Author

Brandon Bruno

Published

I've encountered a particular installation issue with Sitecore 9.1.1 recently: the xConnect Windows services are not starting up properly during installation, which causes a fatal error and ends the installation script prematurely. The error message is clear about this:

[StartServices [1]]:[Updating] sc9test.xconnect.local-IndexWorker
Install-SitecoreConfiguration : Service 'Sitecore XConnect Search Indexer - sc9test.xconnect.local-IndexWorker (sc9test.xconnect.local-IndexWorker)' cannot be started due to the following error: Cannot start service sc9test.xconnect.local-IndexWorker on computer '.'.
At C:\Files\Projects\_TEST\Setup\install-sitecore911.ps1:294 char:5
+     Install-SitecoreConfiguration @xcSiteParams
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 00:04:48
Start-Service : Service 'Sitecore XConnect Search Indexer - sc9test.xconnect.local-IndexWorker (sc9test.xconnect.local-IndexWorker)' cannot be started due to the following error: Cannot start service sc9test.xconnect.local-IndexWorker on computer '.'.
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.1.0\Public\Tasks\Invoke-ManageServiceTask.ps1:40 char:33
+                     $instance | Start-Service
+                                 ~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException
    + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand

(Ignore the formatting up there - I assure you this text was bright red and quite disheartening to debug.)

The Problem

To troubleshoot this, I verified that the services were installed via services.msc:

Two out of three xConnect services are not starting.

The services were created but cannot start. I manually tried to start them and received an "access denied" error message. Yep, there's a permission issue.

The Solution

As it turns out, the parent folders of the xConnect services did not have the proper permissions for the App Pool identity. While it's easy enough to change these permissions on existing folders, the SIF-based Sitecore installation will always fail when trying to start up the xConnect services.

In order to quickly fix this, I added tasks to the xconnect-xp0.json SIF configuration file that update permissions on the service parent folders.

Just after the SetProcessingEngineServicePermissions task, I added the following three tasks. These must be placed after the services creation tasks but before the InstallServices task.

        "SetIndexWorkerServicePermissionsFolder": {
            "Description": "Set permissions for the Index Worker service folder.",
            "Type": "FilePermissions",
            "Params": {
                "Path": "[joinpath(variable('Services.IndexWorker.InstallPath'))]",
                "Rights": [
                    {
                        "User": "NT AUTHORITY\\LocalService",
                        "FileSystemRights": [ "FullControl" ],
                        "InheritanceFlags": [ "ContainerInherit", "ObjectInherit" ]
                    }
                ]
            }
        },
        "SetMarketingAutomationServicePermissionsFolder": {
            "Description": "Set permissions for the Marketing Automation service folder.",
            "Type": "FilePermissions",
            "Params": {
                "Path": "[joinpath(variable('Services.MarketingAutomationEngine.InstallPath'))]",
                "Rights": [
                    {
                        "User": "NT AUTHORITY\\LocalService",
                        "FileSystemRights": [ "FullControl" ],
                        "InheritanceFlags": [ "ContainerInherit", "ObjectInherit" ]
                    }
                ]
            }
        },
        "SetProcessingEngineServicePermissionsFolder": {
            "Description": "Set permissions for the Processing Engine service folder.",
            "Type": "FilePermissions",
            "Params": {
                "Path": "[joinpath(variable('Services.ProcessingEngine.InstallPath'))]",
                "Rights": [
                    {
                        "User": "NT AUTHORITY\\LocalService",
                        "FileSystemRights": [ "FullControl" ],
                        "InheritanceFlags": [ "ContainerInherit", "ObjectInherit" ]
                    }
                ]
            }
        },

After adding those tasks, I re-ran the SIF install and Sitecore installed without any errors.