I'm using Sitecore on Azure
, and I followed the wizard to create a project with a CD and a CM
.
I have a custom index SinglePageUrl
on both of them with a web and a master version to Rewrite some URLs. The index is well populated in both versions.
On CM, when I request a page with a rewritten URL, it works fine. On CD, I get the following error caused by the line of code below,
2017-06-12T11:44:17 PID[1440] Error 4900 11:44:17 ERROR Application error.
Exception: System.InvalidOperationException
Message: Index has not been initialized.
Source: Sitecore.ContentSearch.Azure
at Sitecore.ContentSearch.Azure.CloudSearchProviderIndex.EnsureInitialized()
at Sitecore.ContentSearch.Azure.CloudSearchProviderIndex.CreateSearchContext(SearchSecurityOptions options)
at castelis.Services.ContentSearchService.GetAllResult[T](Expression`1 predicate)
at castelis.Services.ContentSearchService.GetAllResultByLanguage[T](Expression`1 predicate, String languageCode)
at castelis.Pipelines.SinglePageUrlResolver.SearchItemsHavingRequestedUrlAsSinglePageUrlIndex(HttpRequestArgs args)
at castelis.Pipelines.SinglePageUrlResolver.Process(HttpRequestArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Nexus.Web.HttpModule.��(Object ��, EventArgs ��)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Line causing an error,
ContentSearchManager.GetIndex("single_page_url_web_index").CreateSearchContext();
The index is found but then calling CreateSearchContext
throws the exception
I looked at the config files for differences but I can't see where this comes from. CD and CM share the same Sitecore.ContentSearch.Azure.DefaultIndexConfiguration.config
file, hit the same search service, have the same index definition (except CD only has web, not master).
Does anyone have an idea what configuration may differ or where else can the problem come from?