I got two exceptions today trying to use an EPiServer SearchDataSource in order to find files in the VPP directories. Not rocket science solving them, but I thought that I would make a short post anyway hoping it might make somebody’s life easier.
System.IO.IOException: \\server\VPP\Global\index not a directory
The first exception occured as my VPP folders did not yet contain index directories. The EPiServer Indexing Service usually creates them automatically if they do not exist, but in my case it would not. The reason for this was that I had placed my VPPs on a different server. The service was running under Local System, hence was unable to access the directories.
I tried having the service run by another user, which did have access, and that brought me to the second exception.
Update: Apparently, this exception is also caused by omitting to add any indexes to the configuration file (mentioned in the segments exception section below) EPiServer.IndexingService.exe.config (7-8). Since the EPiServer Indexing Service cannot find anything to index, it does not know where to create its index directories.
EPiServer.IndexingService.exe.config
<?xml version="1.0" encoding="utf-8"?> <configuration>
<episerver.indexingService> <indexes> </indexes> </episerver.indexingService> </configuration>
System.IO.IOException: Could not find file \\server\VPP\Global\index\segments
Just as the exception says, the file segments did not exist. It turned out that the Indexing Service had been unable to index the files since it could not access my database. There is a file called EPiServer.IndexingService.exe.config, in the installation’s Indexing Service directory (Something like C:\Program Files (x86)\EPiServer\Shared\Services\Indexing Service) which contains connection strings to different databases; or to one, if you are only using one, obviously.
EPiServer.IndexingService.exe.config
<?xml version="1.0" encoding="utf-8"?> <configuration>
<episerver.indexingService> <indexes> <add connectionString="Data Source=.;Initial Catalog=dbDemo;Integrated Security=False;User ID=dbUser;Password=XXXX;Connect Timeout=10" databaseClient="" filePath="\\server\VPP\Global\" itemRoot="/Global" /> <add connectionString="Data Source=.;Initial Catalog=dbDemo;Integrated Security=False;User ID=dbUser;Password=XXXX;Connect Timeout=10" databaseClient="" filePath="\\server\VPP\Documents\" itemRoot="/Documents" /> <add connectionString="Data Source=.;Initial Catalog=dbDemo;Integrated Security=False;User ID=dbUser;Password=XXXX;Connect Timeout=10" databaseClient="" filePath="\\server\VPP\PageFiles\" itemRoot="/PageFiles" /> </indexes> </episerver.indexingService> </configuration>
Once I had corrected my connectionStrings, which was very wrong for some reason, the Indexing Service was able to do it’s job, and the SearchDataSource would work perfectly.
Note: Make sure that your EPiServer.IndexingService.exe.config file does not contain connection string duplicates; the Indexing Service does not like it, and you will not be getting any segment files if it is not happy.