Let’s Talk

We would love to hear from you. Want to know more about
our services or have any questions? Say Hi!

Null Reference Exception in Sitecore Signing Token Provider

November 21, 2022
Null Reference Exception in Sitecore Signing Token Provider
Ketan Garala
Ketan Garala
CTO, Sitecore MVP

I was installing the instance Sitecore 9.3 that has been configured in the local instance. The installation was smooth and successful but when trying to launch the Sitecore Site with the local host, the below given error appeared.


[NullReferenceException: Object reference not set to an instance of an object.] Sitecore.Services.Infrastructure.Sitecore.Security.SigningTokenProvider..ctor(UserService userService, ConfigurationSettings configurationSettings, ILogger logger, ISigningProvider signingProvider) +526 Sitecore.Services.Infrastructure.Sitecore.Security.SigningTokenProvider..ctor() +137 Sitecore.Services.Infrastructure.Sitecore.Security.TokenDelegatingHandler..ctor() +35 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +139 System.Activator.CreateInstance(Type type, Boolean nonPublic) +105 System.Activator.CreateInstance(Type type) +12 Sitecore.Services.Infrastructure.Configuration.TypeLoader.CreateInstance(Type type, ILogger logger) +63 Sitecore.Services.Infrastructure.Configuration.TypeLoader.Load(Type type) +263 System.Linq.WhereSelectArrayIterator`2.MoveNext() +78 System.Linq.WhereEnumerableIterator`1.MoveNext() +236 System.Linq.Buffer`1..ctor(IEnumerable`1 source) +152 System.Linq.Enumerable.ToArray(IEnumerable`1 source) +91 Sitecore.Services.Infrastructure.Web.Http.ServicesConfigurator.Configure(HttpConfiguration config, RouteCollection routes) +735 Sitecore.Services.Infrastructure.Sitecore.Pipelines.ServicesWebApiInitializer.Process(PipelineArgs args) +194 (Object , Object[] ) +74 Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +469 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22 Sitecore.Nexus.Web.HttpModule.Application_Start() +161 Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +767 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341 [HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107

This issue needs to be resolved as I want to run the local host site and complete the installation process to get the site up and running. But this object reference is not allowing me to set up an instance.

In order to resolve this, I checked my database connection string in the connectionstrings.config file and also double checked with the SQL connection string with the proper username and the password. All the configurations were made correctly which shows that it was not some database issue with the local host site.

The deployment on this site hadn’t been done in over 1 year and some hotfixes as well as prefix configurations were made during that time but when the bin was compared with the config folders, it showed that all configurations remained unchanged.

The specific error that occurred was because of missing one line in the connectionstrings.config file.

<add name="Sitecore.Services.Token.SecurityKey" connectionString="key=XXXxxXXxx11Xx11xxxXxXX1XX1XxXX1X" />

Just by making this change, I was able to access the site again.