Sitecore xConnect Search Indexer Windows Service throwing exception: “The Authority/Host could not be parsed”

I was tweaking connection strings for Sitecore xConnect Search Indexer Windows Service to fix some issues with xConnect and suddenly I started to receive weird exceptions in AppHost log and I couldn’t also start the Windows service anymore.

I was running Sitecore 9 Update 2 with xConnect up and running.

Problem definition

Sitecore xConnect Search Indexer Windows Service started to throw below exception during start up in AppHost log located under $path_to_your_xconnect_site$\App_data\jobs\continuous\IndexWorker\App_data\Logs.

Exception:

[Error] Failed to start the indexer host
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. 
---> System.UriFormatException: Invalid URI: The Authority/Host could not be parsed.

Full exception can be found at the end of article.

 

Solution

I have opened dotPeek to decompile code around exception and found out where the problem is originating.

It was in connection string that was faulty set to “Solr UI URL format”.

Connection strings for Search Indexer Windows Service are located under $path_to_your_xconnect_site$\App_data\jobs\continuous\IndexWorker\App_config\ in file ConnectionStrings.config.

Instead of correct value:

<add name="solrCore" connectionString="https://localhost:8984/solr/sc9u2_xdb" />

it was set to Solr URL style which was wrong:

<add name="solrCore" connectionString="https://localhost:8984/solr/#/sc9u2_xdb" />

Mind the “/#” in wrong url. This is the correct URL when you are accessing Solr core through Solr UI but not in the config for Search Indexer service:

xConnect Solr url.png

 

If you are facing similar exceptions in logs, it is highly probable that you have also wrong URL defined for Solr core based on the decompiled code.

 

Full exception

Full exception thrown by Sitecore xConnect Search Indexer Windows Service:

[Error] Failed to start the indexer host
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UriFormatException: Invalid URI: The Authority/Host could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Sitecore.Xdb.Collection.Search.Solr.SolrCoreUri.ReplaceCoreName(String newCoreName)
at Sitecore.Xdb.Collection.Search.Solr.SolrWriterSettings..ctor(SolrCoreUri coreUri, Int32 maximumUpdateBatchSize, Int32 maximumDeleteBatchSize, Int32 maximumCommitMilliseconds, Int32 parallelizationDegree, Int32 retryCount, Int32 maximumRetryDelayMilliseconds, Encoding encoding, IndexerSettings indexerSettings)
at Sitecore.Xdb.Collection.Search.Solr.RebuildSolrWriterSettings..ctor(String rebuildCoreName, SolrWriterSettings solrWriterSettings, Uri rebuildCoreWriteUrl, Uri rebuildCoreCleanUri, Uri rebuildCoreStatusPath, Uri swapCoresUri, Uri coreAdminUrl, Uri rebuildCoreCommitUrl)
at Sitecore.Xdb.Collection.Search.Solr.RebuildSolrWriterSettings..ctor(SolrWriterSettings settings, String rebuildCoreName)
at Sitecore.Xdb.Collection.Search.Solr.SolrIndexRebuilder.GetRebuildSolrWriterSettings(SolrWriterSettings settings)
at Sitecore.Xdb.Collection.Search.Solr.SolrIndexRebuilder..ctor(SolrWriterSettings writerSettings, XdbModel xdbModel)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Configuration.ConfigurationServiceType.<>c__DisplayClass24_0.<op_Implicit>b__0(IServiceProvider sp)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Configuration.ConfigurationServiceType.<>c__DisplayClass24_0.<op_Implicit>b__0(IServiceProvider sp)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Sitecore.XConnect.Search.Indexer.IndexerHost..ctor(IConfigurationRoot config)
at Sitecore.XConnect.Search.Indexer.IndexerAppDomainHost.IndexerHostAppDomainBridge..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at Sitecore.XConnect.Search.Indexer.IndexerAppDomainHost.CreateAppDomainAndIndexer()
at Sitecore.XConnect.Search.Indexer.IndexerAppDomainHost.Start()
at Sitecore.XConnect.Search.Indexer.Service.OnStart(String[] args)

 

Happy debugging 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.