Description:I am getting following error on a website developed using sitecore 9 and already hosted on my local environment and was working until I have just installed another instance of website using sitecore 9.1 the site previously working fine,started throwing following error.
Server Error in '/' Application.
Data at the root level is invalid. Line 1, position 1.
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.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
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:
[XmlException: Data at the root level is invalid. Line 1, position 1.]
System.Xml.XmlTextReaderImpl.Throw(Exception e) +88
System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() +6683419
System.Xml.XmlTextReaderImpl.ParseDocumentContent() +336
System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) +60
System.Xml.Linq.XDocument.Parse(String text, LoadOptions options) +147
SolrNet.Impl.SolrCoreAdmin.Status() +67
Sitecore.ContentSearch.SolrProvider.SolrStatus.OkSolrStatus() +73
Sitecore.ContentSearch.SolrProvider.SolrStatus..cctor() +72
[TypeInitializationException: The type initializer for 'Sitecore.ContentSearch.SolrProvider.SolrStatus' threw an exception.]
Sitecore.ContentSearch.SolrProvider.SolrStatus.SetIndexForInitialization(ISearchIndex solrIndex) +0
Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.SetForReinitialization() +202
Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.InitializeSolr() +129
Sitecore.ContentSearch.SolrProvider.SolrSearchIndex.Initialize() +46
Sitecore.ContentSearch.SolrProvider.SolrContentSearchManager.Initialize() +169
Sitecore.ContentSearch.SolrProvider.SolrNetIntegration.DefaultSolrStartUp.Initialize() +913
(Object , Object[] ) +71
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) +764
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +570
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +169
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +372
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +329
[HttpException (0x80004005): The type initializer for 'Sitecore.ContentSearch.SolrProvider.SolrStatus' threw an exception.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +708
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2633.0
Posted by: Sam Smith | Posted on: Jul 31, 2019
4
But you can easily resolve your issue by just enabling your compatible solr version,i.e sitecore 9 is compatible with solr 6.6.2 so you just need to open your local services and stop the other solr version(solr-7.2.1) and start solr-6.6.2 screenshot for your reference. then just restart your site it will be working fine.
Replied by: Tabish Usman | Replied on: Aug 02, 2019