Upgrade from 7.2 to 9 - NullReferenceException at Sitecore.Configuration.XmlConfigStore.get_RootRecord()

I've just upgraded a 7.2 solution to 9.0 and this is the first time I run the site. It takes very long to load and then finally gives me the following exception.

This is a very vague Sitecore error and I honestly don't know where to even start with this. Can anyone please give me some pointers???

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   Sitecore.Configuration.XmlConfigStore.get_RootRecord() +18
   Sitecore.Security.Domains.ConfigStoreDomainProvider.Reload() +54
   Sitecore.Configuration.DefaultFactory.GetProviders(List`1 nodes) +598
   Sitecore.Configuration.DefaultFactory.GetProviders(String rootPath, TProvider& defaultProvider) +328
   Sitecore.Configuration.ProviderHelper`2.ReadProviders() +74
   Sitecore.Configuration.ProviderHelper`2.get_Provider() +115
   Sitecore.SecurityModel.DefaultDomainManager.GetDomain(String name) +43
   Sitecore.Sites.SiteContext.get_Domain() +41
   Sitecore.Web.XFrameOptionsHeaderModule.IsSitecoreDomainRequest() +55
   Sitecore.Web.XFrameOptionsHeaderModule.ShouldProtectWithFrameOptionsHeader(HttpContextBase httpContextBase) +23
   Sitecore.Web.XFrameOptionsHeaderModule.BeginRequestHandler(Object sender, EventArgs e) +44
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +222
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +212
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +90
  • In general from the stack trace I can tell the error is related to config files. I just ran into an error with a similar stack trace. The website I was updating was missing a App_Config\Security\Domains.config file (and the GlobalRoles.config).

    Hopefully you were able to solve this error by making sure you had the right config files deployed.