Initialize action failed for Initialize on class EPiServer.Find.Commerce.FindCommerceInitializationModule

  • Updated

In some cases you may find that the site does not start up and gives the following error. 

 Unhandled exception. EPiServer.Framework.Initialization.InitializationException: Initialize action failed for Initialize on class EPiServer.Find.Commerce.FindCommerceInitializationModule, EPiServer.Find.Commerce, Version=, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
 --- System.ApplicationException: Could not apply catalog content conventions.
                        The content indexed during this session will not contain important additional fields and searches might work incorrectly, until the site restarts and the conventions are applied successfully.
                        We recommend to fix the following exception, but if you are certain this exception can be safely ignored, add 'episerver:findcommerce.IgnoreWebExceptionOnInitialization' key with value = true to appSettings.
 --- EPiServer.Find.ServiceException: Response status code does not indicate success: 503 (Service Unavailable).
Undefined Internal Error - 1708435487117
 --- System.Net.Http.HttpRequestException: Response status code does not indicate success: 503 (Service Unavailable).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at EPiServer.Find.Connection.JsonRequest.GetResponseStream()
   --- End of inner exception stack trace ---
   at EPiServer.Find.Api.Command.GetResponse[TResult](IJsonRequest request)
   at EPiServer.Find.Api.PutMappingCommand.Execute()
   at EPiServer.Find.ClientConventions.NestedConventions.AddNestedType(IEnumerable`1 declaringTypes, String name)
   at EPiServer.Find.ClientConventions.NestedConventions.MarkAllImplementationsAsNested(Type declaringType, String name)
   at EPiServer.Find.ClientConventions.NestedConventions.ForInstancesOf[TSource,TListItem](Expression`1 exp)



As it mentions you can use IgnoreWebExceptionOnInitialization to bypass the error, but there may be issues with search functionality. That said, it is probably more important that the site loads. To change IgnoreWebExceptionOnInitialization in CMS 12, modify the startup.cs file with the following. 

 services.Configure<FindCommerceOptions>(o => o.IgnoreWebExceptionOnInitialization = true); 
In CMS 11 use this app setting. 
<add key="episerver:findcommerce.IgnoreWebExceptionOnInitialization" value="true"/>