Skip to content

Troubleshooting EPiServer search indexing-service

July 4, 2015

In a project I am working in we have experienced problems getting the EPiServer search indexing-service to work. We do not use EPiServer search as search-engine for the users. We just want to use it to be able to search in edit-mode, eg. search for page-id and page-name. We have a load-balanced environment with two “user-surf-nodes” and one edit-node. EPiServer search is just configured on the edit-node. The edit-node was first configured like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    ...
    <episerver.search active="true">
        <namedIndexingServices defaultService="IndexingService">
            <services>
                <add name="IndexingService" accessKey="local" baseUri="http://HOSTNAME/Services/IndexingService.svc" />
            </services>
        </namedIndexingServices>
        ...
    </episerver.search>
    ...
</configuration>

We could not get indexing to work. We had to configure it with the machine-specific ip, like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    ...
    <episerver.search active="true">
        <namedIndexingServices defaultService="IndexingService">
            <services>
                <add name="IndexingService" accessKey="local" baseUri="http://xxx.xxx.xxx.xxx/Services/IndexingService.svc" />
            </services>
        </namedIndexingServices>
        ...
    </episerver.search>
    ...
</configuration>

We also have a “Services”-directory in the project where we put the IndexingService.svc and System.Web.Http.ApiController-services (client-json-services). We dont want anonymous access to the client services so we have the following section in “Web.config”:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    ...
    <location path="Services">
        <system.web>
            <authorization>
                <deny users="?" />
            </authorization>
        </system.web>
    </location>
    ...
</configuration>

With this set the search index could not be created. The path to “IndexingService.svc” have to allow anonymous access. So we had to add the following:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    ...
    <location path="Services/IndexingService.svc">
        <system.web>
            <authorization>
                <allow users="*" />
            </authorization>
            ...
        </system.web>
        ...
    </location>
    ...
</configuration>

Summary

  • If you have a load-balanced environment try to configure the baseUri with a machine-specific IP-number or a machine-specific hostname instead of the load-balancer hostname, eg. http://xxx.xxx.xxx.xxx/&#8230; or http://hostname-node-a/&#8230;.
  • You have to allow anonymous access to the path of the baseUri.

Troubleshooting

An easy way to verify if the index is created or not is to see if the index-directory is created or not. If you have the directory try to remove it and see if it is recreated. Our index-directory was not created. The index-directory is configured here:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    ...
    <episerver.search.indexingservice>
        ...
        <namedIndexes defaultIndex="default">
            <indexes>
                <add name="default" directoryPath="[appDataPath]\Index" readonly="false" />
            </indexes>
        </namedIndexes>
    </episerver.search.indexingservice>
    ...
</configuration>

To troubleshoot I temporarilly set the log4net-configuration file content to this:

<?xml version="1.0" encoding="utf-8"?>
<log4net>
    <appender name="SearchSettingsAppender" type="log4net.Appender.RollingFileAppender">
        <appendToFile value="true"/>
        <datePattern value=".yyyyMMdd.'log'"/>
        <encoding value="utf-8"/>
        <file value="..\Application-Data\Logs\SearchSettings.log"/>
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date [%thread], level = %level, logger = %logger: %message%n"/>
        </layout>
        <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
        <rollingStyle value="Date"/>
        <staticLogFileName value="true"/>
    </appender>
    <logger name="SearchSettings">
        <appender-ref ref="SearchSettingsAppender" />
        <level value="All" />
    </logger>
</log4net>

Then I tried to reindex with this feature:

To really start the reindexing I had to click the “Start Indexing” button multiple times. The request should start to process for a longer time. If the request finishes immediately, try click the button again.

When we had problems configuring the indexing-service by hostname, the following lines in the log-file helped:

  • Update batch could not be sent to service uri ‘http://HOSTNAME/Services/IndexingService.svc/update/?accesskey=local&#8217;. Message: ‘The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. at System.Net.HttpWebRequest.GetResponse()
    at EPiServer.Search.RequestHandler.MakeHttpRequest(String url, NamedIndexingServiceElement namedIndexingServiceElement, String method, Stream postData, Action`1 responseHandler)
    at EPiServer.Search.RequestHandler.SendRequest(SyndicationFeed feed, String namedIndexingService, Collection`1 ids)’
  • Could not reset index ” for service uri ‘http://HOSTNAME/Services/IndexingService.svc/reset/?namedindex=&accesskey=local&#8217;. Message: The underlying connection was closed: An unexpected error occurred on a receive. at System.Net.HttpWebRequest.GetResponse()
    at EPiServer.Search.RequestHandler.MakeHttpRequest(String url, NamedIndexingServiceElement namedIndexingServiceElement, String method, Stream postData, Action`1 responseHandler)
    at EPiServer.Search.RequestHandler.ResetIndex(String namedIndexingService, String namedIndex)

When we had problems with access to the indexing-service, the following lines in the log-file helped:

  • Update batch could not be sent to service uri ‘http://xxx.xxx.xxx.xxx/Services/IndexingService.svc/update/?accesskey=local&#8217;. Message: ‘The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. at System.Net.HttpWebRequest.GetResponse()
    at EPiServer.Search.RequestHandler.MakeHttpRequest(String url, NamedIndexingServiceElement namedIndexingServiceElement, String method, Stream postData, Action`1 responseHandler)
    at EPiServer.Search.RequestHandler.SendRequest(SyndicationFeed feed, String namedIndexingService, Collection`1 ids)’
  • Could not reset index ” for service uri ‘http://xxx.xxx.xxx.xxx/Services/IndexingService.svc/reset/?namedindex=&accesskey=local&#8217;. Message: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse()
    at EPiServer.Search.RequestHandler.MakeHttpRequest(String url, NamedIndexingServiceElement namedIndexingServiceElement, String method, Stream postData, Action`1 responseHandler)
    at EPiServer.Search.RequestHandler.ResetIndex(String namedIndexingService, String namedIndex)
Advertisements

From → EPiServer

3 Comments
  1. Neil F permalink

    After an EPiServer upgrade (to 10) we started seeing lots of index corrupt errors such as those above.

    Saw this: http://world.episerver.com/forum/developer-forum/-EPiServer-75-CMS/Thread-Container/2015/11/episerver-search-index-reset—no-segments-error-messages/

    So we renamed the target indexing folder (i.e. in web.config) which resolved the issue. NB: Switching back to the original name, the errors started occurring again. All permissions the same so this seems a workaround for a long standing EPiServer bug.

Trackbacks & Pingbacks

  1. Troubleshooting EPiServer 7+ search indexing-service | Andreas Plahn Developer Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: