HTTP Error 502.5 - Process Failure while accessing Sitecore Identity Server

During Sitecore Commerce Installation I hit the following error:

________________________________________________________________________________

Error: Get Token From Sitecore.IdentityServer

Install-SitecoreConfiguration :   IIS 502.5 Error HTTP Error 502.5 - Process Failure Common causes of this issue: The application process

failed to start The application process started but then stopped  The application process started but failed to listen on the configured port

________________________________________________________________________________

I then back-tracked to find that my Sitecore 10 installation in XP0 topology (used SIA for installation) had the following error when trying to access the identity server:

_______________________________________________________________________________

HTTP Error 502.5 - Process Failure 

Common causes of this issue: 

The application process failed to start 

The application process started but then stopped 

The application process started but failed to listen on the configured port 

Troubleshooting steps: 

Check the system event log for error messages 

Enable logging the application process' stdout messages 

Attach a debugger to the application process and inspect 

_______________________________________________________________________________

When i checked the error log, i saw the following:

6896 07:23:46 ERROR Unable to reach an external identity provider.

Exception: System.InvalidOperationException
Message: IDX20803: Unable to obtain configuration from: '[PII is hidden]'.
Source: Microsoft.IdentityModel.Protocols
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.<GetConfigurationAsync>d__24.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 Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationHandler.<ApplyResponseChallengeAsync>d__10.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 Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseCoreAsync>d__40.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 Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseAsync>d__39.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 Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<TeardownAsync>d__34.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 Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.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 Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.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 Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.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 Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__5.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 Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.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 Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.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 Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__3.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.Owin.Middlewares.GlobalExceptionHandlerMiddleware.<Invoke>d__4.MoveNext()


Context and Solution:

I used a brand new VM and had not installed one of the pre-requisites: ASP.NET Core 2.1 Runtime (v2.1.18) - Windows Hosting Bundle Installer 

When I downloaded and installed the same, identity server was accessible without any errors and the commerce installation was successful too. 


On hindsight,  wondering why SIA pre-requisites installation missed installing ASP.NET core runtime version 2.1.18  if it's a requirement!

One other scenario wherein I had this error was I created a second instance of Commerce but since I hadn't given different names for the commerce websites (commerce_ops, commerce_shops etc.), my second instance's port had overwritten the first's port and then when I tried to access the first site, the identity server started throwing the above error and although I corrected the port numbers in the commerce site's bindings, did a reset , restart etc. my first identity site never came back and I had no other go but to re-install. Pretty bad but that is what I did. So, I normally ensure that the commerce site names are unique with unique ports if creating multiple instances, inc. Solr (except Redis) in the same machine.


Comments