3

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?

2 Answers 2

4

Alright, the Sitecore.ContentSearch.Azure.dll file in the CD was not (by default) the same version as in the CM. I copied the CM version to the CD bin folder and it works. (but I have no idea why the default installation puts two different files)

Here is a comparison of the detail of the two dlls,

LEFT: CM version, RIGHT: CD version enter image description here

-1

You mentioned that the index was named "SinglePageUrl" but the request for the index seems to be using the name "single_page_url_web_index". Is that a typo? If not, then the first thing I would investigate is how the name is being set. You can do this in ShowConfig.aspx to see which patch file set the index definition.

The name you use to call needs to match the name defined for the index in the configurations.

2
  • There is no error with the name, it is called single_page_url_web_index in the definition and I can see it is well populated through Azure Search Explorer. I can't see the showconfig on CD :/ Commented Jun 12, 2017 at 12:36
  • Why can't you see the showconfig on the CD? 403 error? I know this is standard to configure in such way that this page is forbidden on the CD but if that's the case you can enable it temporarily to see the output you get and disabled afterwards...
    – Diego
    Commented Jun 12, 2017 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.