Replicating the Failed to start service Sitecore Marketing Automation Engine Installation Error

The Failed to start service Sitecore Marketing Automation Engine installation error is pretty infamous. I wrote a blogpost with a solution for the same here but the error seems to have other entry points too. So, I decided to replicate the error on my machine and this blogpost is about the same.

Since this error occurs while trying to start the Sitecore Marketing Automation Engine Service. I decided to look at the location where service accounts are stored in my machine. You can find the service accounts as follows - 

1. Go to Windows Administrative Tools -> Local Security Policy 

2. Double Click Local Security Policy in the right pane above:


Note that you can't access the local security policy if you are NOT logged in as  an administrator to the machine.

3. Then, if you expand Local Policies in the left pane in the above window, you will find User Rights Assignment:


4. When you click the User Rights Assignment in the left pane, you can see the list of policies in the right:


5. Out of the policies, if you double click the "Log on as a service" policy, you must see this window with a list of identities that can start/stop services. In my machine, I could find my xConnect app pool identities too:


6. Since my machine didn't have any issues with MA service start, I wanted to go conversely and fail my installation for that scenario. So, one of the ways to do the same is to check what happens if I deny permission for the xConnect app pool to create service. So, I added the xConnect app pool identity to Deny as a Service list:

Click apply once you enter the correct app pool identity. 

Note that the identity must be prefixed with the app pool prefix. So, the identity must look like this IIS APPPOOL\sc1001xconnect.local instead of just sc1001xconnect.local shown in the screen shot above.

7. I then uninstalled the concerned instance using Sitecore Complete Install Assistant -


8. I relaunched the installation for the same instance:


9. I could simulate the error since Marketing Automation engine failed to start because the xConnect app pool identity didn't have access to perform the operation.

Sorry about the difference in the instance name between what is in this blog post and in the screen shot above but you have to believe me that the error occurred!

So, the converse theory derived from this simulation is, maybe your xConnect App pool identity isn't created in the "Logon as a service" list. I'm yet to find why it wouldn't be created and what permissions are needed but this is the starting point to look at!

Note that I could simulate the error this way in a Windows 2016 server machine and when I tried the same  steps in a Windows 10 Pro machine, the installation was still successful!

But, I was unrelenting! In the Windows 10 Pro machine, I decided to mess up the access rights for the xConnect folder and so I denied access to the concerned folder for the xConnect principal:

Then, when I re-executed the installation, I could reproduce the error!


Another scenario: I denied read and execute permission for <machine name>\IIS_IUSRS on the xConnect folder and the installation failed with the same error:


So, the bottom line: this error can manifest if there are access issues on your xConnect folder or service logon issues. 

For reference, here are the security permissions and log on as a service policy details on a working machine:

Security Permissions on instance folders:

Read & execute:

<machine name>\Users

<machine name>\IIS_IUSRS

Full Control:

<machine name>\Administrators

System

TrustedInstaller

<instance name> (for respective instance)


"Log on as a service" list:



Certificates folder permissions (just for reference):


Log Reference:

Windows 2016 Server Error Log:

Application: Sitecore.MAEngine.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.InvalidOperationException

   at Sitecore.XConnect.Client.XConnectClientConfiguration.CheckInitialized()

   at Sitecore.XConnect.Client.XConnectClientConfiguration.get_CurrentModel()

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Sitecore.XConnect.Configuration.Extensions+<>c__DisplayClass33_0.<UseServiceDecorator>b__1(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(Microsoft.Extensions.DependencyInjection.ServiceLookup.TransientCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(Microsoft.Extensions.DependencyInjection.ServiceLookup.IEnumerableCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.IServiceProvider)

   at Sitecore.Xdb.MarketingAutomation.Engine.App.ServiceConfiguration.get_Engine()

   at Sitecore.Xdb.MarketingAutomation.Engine.App.EngineService.OnStart(System.String[])

   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(System.Object)

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.ServiceProcess.ServiceBase.Run(System.ServiceProcess.ServiceBase[])

   at Sitecore.Xdb.MarketingAutomation.Engine.App.Program.RunAsService()

   at Sitecore.Xdb.MarketingAutomation.Engine.App.Program.Main(System.String[])


Log info in Automation Engine Log - C:\inetpub\wwwroot\s<xconnect instance name>\App_Data\jobs\continuous\AutomationEngine\App_Data\Logs:

2021-02-07 09:59:22.113 +11:00 [Error] Error initializing XConnect client.

System.AggregateException: One or more errors occurred. ---> Sitecore.XConnect.XdbCollectionUnavailableException: The HTTP response was not successful: ServiceUnavailable

   at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__7.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Sitecore.XConnect.Client.XConnectClientConfiguration.<InitializeAsync>d__34.MoveNext()

   --- End of inner exception stack trace ---

   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

   at Sitecore.XConnect.Client.Configuration.XConnect.Extensions.ServiceCollectionExtensions.InitializeXConnectClientConfiguration(IServiceProvider provider, XConnectClientConfiguration config)

---> (Inner Exception #0) Sitecore.XConnect.XdbCollectionUnavailableException: The HTTP response was not successful: ServiceUnavailable

   at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__7.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Sitecore.XConnect.Client.XConnectClientConfiguration.<InitializeAsync>d__34.MoveNext()<---


2021-02-07 09:59:22.257 +11:00 [Error] Failed to start the Marketing Automation Engine service.

System.InvalidOperationException: This configuration has not been initialized. Please call the initialize method before using it.

   at Sitecore.XConnect.Client.XConnectClientConfiguration.CheckInitialized()

   at Sitecore.XConnect.Client.XConnectClientConfiguration.get_CurrentModel()

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)

   at Sitecore.XConnect.Configuration.Extensions.<>c__DisplayClass33_0.<UseServiceDecorator>b__1(IServiceProvider provider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)

   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)

   at Sitecore.Xdb.MarketingAutomation.Engine.App.ServiceConfiguration.get_Engine()

   at Sitecore.Xdb.MarketingAutomation.Engine.App.EngineService.OnStart(String[] args)

Windows 10 Pro Error Log:

Application: Sitecore.MAEngine.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.InvalidOperationException

   at Sitecore.XConnect.Client.XConnectClientConfiguration.CheckInitialized()

   at Sitecore.XConnect.Client.XConnectClientConfiguration.get_CurrentModel()

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Sitecore.XConnect.Configuration.Extensions+<>c__DisplayClass33_0.<UseServiceDecorator>b__1(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(Microsoft.Extensions.DependencyInjection.ServiceLookup.TransientCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(Microsoft.Extensions.DependencyInjection.ServiceLookup.IEnumerableCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ConstructorMatcher.CreateInstance(System.IServiceProvider)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite, Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine+<>c__DisplayClass1_0.<RealizeService>b__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope)

   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.IServiceProvider)

   at Sitecore.Xdb.MarketingAutomation.Engine.App.ServiceConfiguration.get_Engine()

   at Sitecore.Xdb.MarketingAutomation.Engine.App.EngineService.OnStart(System.String[])

   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(System.Object)

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.ServiceProcess.ServiceBase.Run(System.ServiceProcess.ServiceBase[])

   at Sitecore.Xdb.MarketingAutomation.Engine.App.Program.RunAsService()

   at Sitecore.Xdb.MarketingAutomation.Engine.App.Program.Main(System.String[])

Comments

Popular Posts