protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); StructureMapFactory.Init(); var container = StructureMapFactory.GetContainer(); container.Configure(x => x.For <IControllerActivator>().Use <StructureMapControllerActivator>()); DependencyResolver.SetResolver(new StructureMapDependencyResolver(container)); var config = GlobalConfiguration.Configuration; config.Services.Replace(typeof(IHttpControllerActivator), new StructureMapWebApiActivator(config)); ElasticRepository.ElasticSearchCreateIndices(); }