public static IUmbracoBuilder AddBackOfficeCore(this IUmbracoBuilder builder) { builder.Services.AddSingleton <KeepAliveMiddleware>(); builder.Services.ConfigureOptions <ConfigureGlobalOptionsForKeepAliveMiddlware>(); builder.Services.AddSingleton <ServerVariablesParser>(); builder.Services.AddSingleton <InstallAreaRoutes>(); builder.Services.AddSingleton <BackOfficeAreaRoutes>(); builder.Services.AddSingleton <PreviewRoutes>(); builder.AddNotificationAsyncHandler <ContentCacheRefresherNotification, PreviewHubUpdater>(); builder.Services.AddSingleton <BackOfficeServerVariables>(); builder.Services.AddScoped <BackOfficeSessionIdValidator>(); builder.Services.AddScoped <BackOfficeSecurityStampValidator>(); // register back office trees // the collection builder only accepts types inheriting from TreeControllerBase // and will filter out those that are not attributed with TreeAttribute var umbracoApiControllerTypes = builder.TypeLoader.GetUmbracoApiControllers().ToList(); builder.Trees() .AddTreeControllers(umbracoApiControllerTypes.Where(x => typeof(TreeControllerBase).IsAssignableFrom(x))); builder.AddWebMappingProfiles(); builder.Services.AddUnique <IPhysicalFileSystem>(factory => { var path = "~/"; var hostingEnvironment = factory.GetRequiredService <IHostingEnvironment>(); return(new PhysicalFileSystem( factory.GetRequiredService <IIOHelper>(), hostingEnvironment, factory.GetRequiredService <ILogger <PhysicalFileSystem> >(), hostingEnvironment.MapPathContentRoot(path), hostingEnvironment.ToAbsolute(path) )); }); builder.Services.AddUnique <IIconService, IconService>(); builder.Services.AddUnique <IConflictingRouteService, ConflictingRouteService>(); builder.Services.AddSingleton <UnhandledExceptionLoggerMiddleware>(); return(builder); }