diff --git a/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs index 4e00525c2a..be18faf4ee 100644 --- a/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs +++ b/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs @@ -45,6 +45,12 @@ namespace Umbraco.Extensions services.ConfigureOptions(); } + // AddUmbracoPreview -> Use in UmbracoBuilderExtensions + public static void AddUmbracoPreview(this IServiceCollection services) + { + services.AddSignalR(); + } + /// /// Adds the services required for using Umbraco back office Identity /// diff --git a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs index 71325d70d4..a1a671527a 100644 --- a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBuilderExtensions.cs @@ -16,6 +16,7 @@ namespace Umbraco.Extensions .WithMiniProfiler() .WithMvcAndRazor() .WithWebServer() + .WithPreview() .Build(); } @@ -24,5 +25,8 @@ namespace Umbraco.Extensions public static IUmbracoBuilder WithBackOfficeIdentity(this IUmbracoBuilder builder) => builder.AddWith(nameof(WithBackOfficeIdentity), () => builder.Services.AddUmbracoBackOfficeIdentity()); + + public static IUmbracoBuilder WithPreview(this IUmbracoBuilder builder) + => builder.AddWith(nameof(WithPreview), () => builder.Services.AddUmbracoPreview()); } } diff --git a/src/Umbraco.Web.BackOffice/Routing/BackOfficeAreaRoutes.cs b/src/Umbraco.Web.BackOffice/Routing/BackOfficeAreaRoutes.cs index dd3b3988c9..cd8aaabf27 100644 --- a/src/Umbraco.Web.BackOffice/Routing/BackOfficeAreaRoutes.cs +++ b/src/Umbraco.Web.BackOffice/Routing/BackOfficeAreaRoutes.cs @@ -1,10 +1,12 @@ -using Microsoft.AspNetCore.Routing; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Options; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.Models; using Umbraco.Core.Hosting; using Umbraco.Web.BackOffice.Controllers; +using Umbraco.Web.BackOffice.SignalR; using Umbraco.Web.Common.Controllers; using Umbraco.Web.Common.Routing; using Umbraco.Web.WebApi; @@ -50,8 +52,8 @@ namespace Umbraco.Web.BackOffice.Routing MapMinimalBackOffice(endpoints); endpoints.MapUmbracoRoute(_umbracoPathSegment, Constants.Web.Mvc.BackOfficeArea, null); + endpoints.MapHub("/umbraco/previewHub"); AutoRouteBackOfficeControllers(endpoints); - break; case RuntimeLevel.BootFailed: case RuntimeLevel.Unknown: