Error connecting to /.well-known/openid-configuration: Bad Gateway

Recently, was playing with the Serialization DevEx environment configuration dll. During one of my experiments, the login method failed to work all of a sudden.

- Tried restarting IIS

- Tried machine restart

- Cleared all cookies and restarted to be double sure!

Then, decided to take a more developer-oriented analytical approach to solve the problem. My code actually invoked the login method part of EnvironmentConfiguration. I added a task wait so that the method could execute successfully. After this, the code jumped to the exception block:

Holy Grail! My good old COM Exception!


Believe me, all this worked fine about an hour ago. Then, I took a nap, came back and this error started occurring! A typical developer scenario and no one actually believes us when we say that  the exact cause for the error is because we turned slightly to the right or the computer did not like us looking at that bird outside the window!


But then, here I was, no one asking for reasons except me and the spooky error! Pretty haunted feeling! Anyway, mustering some courage, I first checked the exception details:


Some relief there, I can see Identity Server is the cause. Checked the identity server url next to find HTTP Error 502.5 - Process Failure :

Ok, turned to my friend windows event viewer to see if I can find some clues there. Luckily I did:


Since the error points an issue while running dotnet command on the Sitecore.IdentityServer.Host.dll, I decided to fire the command through the command prompt and voila, I got better visibility:


Replaced the expired license file in the sitecoreruntime folder under the id server root:


I could now access the id server after an IIS restart:


The login task/wait in my code too executed fine after this!

Thought for the day/night: Every paranormal activity has a logical reasoning! 

Error:

Unhandled Exception: Sitecore.Framework.Runtime.Licensing.Exceptions.SitecoreLicenseInvalidOperationException: Invalid or expired license. [File]

   at Sitecore.Framework.Runtime.Licensing.LicenseValidator.LoadLicense(License license)

   at Sitecore.Framework.Runtime.Commands.SitecoreHostCommand.OnExecuteAsync(CommandLineApplication app)

   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.InvokeAsync(MethodInfo method, Object instance, Object[] arguments)

   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context, CancellationToken cancellationToken)

   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()

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

   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)

   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](CommandLineContext context, CancellationToken cancellationToken)

   at Sitecore.Program.<Main>(String[] args)

Comments