diff --git a/src/Umbraco.Configuration/Models/HostingSettings.cs b/src/Umbraco.Configuration/Models/HostingSettings.cs
index 4a156cee6a..7cfc08d2d4 100644
--- a/src/Umbraco.Configuration/Models/HostingSettings.cs
+++ b/src/Umbraco.Configuration/Models/HostingSettings.cs
@@ -22,6 +22,6 @@ namespace Umbraco.Configuration.Models
/// Gets a value indicating whether umbraco is running in [debug mode].
///
/// true if [debug mode]; otherwise, false.
- public bool DebugMode => _configuration.GetValue(Prefix+":Debug", false);
+ public bool DebugMode => _configuration.GetValue(Prefix+"Debug", false);
}
}
diff --git a/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs b/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs
index 61d7cff240..4d153d8922 100644
--- a/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs
+++ b/src/Umbraco.Core/Composing/DefaultUmbracoAssemblyProvider.cs
@@ -22,6 +22,9 @@ namespace Umbraco.Core.Composing
"Umbraco.PublishedCache.NuCache",
"Umbraco.ModelsBuilder.Embedded",
"Umbraco.Examine.Lucene",
+ "Umbraco.Web.Common",
+ "Umbraco.Web.BackOffice",
+ "Umbraco.Web.Website",
};
public DefaultUmbracoAssemblyProvider(Assembly entryPointAssembly)
diff --git a/src/Umbraco.Web.BackOffice/AspNetCore/UmbracoBackOfficeServiceCollectionExtensions.cs b/src/Umbraco.Web.BackOffice/AspNetCore/UmbracoBackOfficeServiceCollectionExtensions.cs
index 135ba90b97..b63988d4e5 100644
--- a/src/Umbraco.Web.BackOffice/AspNetCore/UmbracoBackOfficeServiceCollectionExtensions.cs
+++ b/src/Umbraco.Web.BackOffice/AspNetCore/UmbracoBackOfficeServiceCollectionExtensions.cs
@@ -18,6 +18,7 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Logging.Serilog;
using Umbraco.Core.Persistence;
using Umbraco.Core.Runtime;
+using Umbraco.Web.Common.Runtime.Profiler;
namespace Umbraco.Web.BackOffice.AspNetCore
{
@@ -118,7 +119,7 @@ namespace Umbraco.Web.BackOffice.AspNetCore
private static void CreateCompositionRoot(IServiceCollection services)
{
// TODO: This isn't the best to have to resolve the services now but to avoid this will
- // require quite a lot of re-work.
+ // require quite a lot of re-work.
var serviceProvider = services.BuildServiceProvider();
var httpContextAccessor = serviceProvider.GetRequiredService();
@@ -142,11 +143,26 @@ namespace Umbraco.Web.BackOffice.AspNetCore
new AspNetCoreMarchal());
var backOfficeInfo = new AspNetCoreBackOfficeInfo(globalSettings);
- var profiler = new LogProfiler(logger);
+ var profiler = GetWebProfiler(hostingEnvironment, httpContextAccessor);
Current.Initialize(logger, configs, ioHelper, hostingEnvironment, backOfficeInfo, profiler);
}
+ private static IProfiler GetWebProfiler(Umbraco.Core.Hosting.IHostingEnvironment hostingEnvironment, IHttpContextAccessor httpContextAccessor)
+ {
+ // create and start asap to profile boot
+ if (!hostingEnvironment.IsDebugMode)
+ {
+ // should let it be null, that's how MiniProfiler is meant to work,
+ // but our own IProfiler expects an instance so let's get one
+ return new VoidProfiler();
+ }
+
+ var webProfiler = new WebProfiler(httpContextAccessor);
+ webProfiler.Start();
+
+ return webProfiler;
+ }
private class AspNetCoreBootPermissionsChecker : IUmbracoBootPermissionChecker
{
public void ThrowIfNotPermissions()
diff --git a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj
index bd20769d45..5b031c095e 100644
--- a/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj
+++ b/src/Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj
@@ -18,6 +18,7 @@
+
diff --git a/src/Umbraco.Web.BackOffice/AspNetCore/AspNetCoreUmbracoApplicationLifetime.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreUmbracoApplicationLifetime.cs
similarity index 97%
rename from src/Umbraco.Web.BackOffice/AspNetCore/AspNetCoreUmbracoApplicationLifetime.cs
rename to src/Umbraco.Web.Common/AspNetCore/AspNetCoreUmbracoApplicationLifetime.cs
index f597c40252..45cfb7d570 100644
--- a/src/Umbraco.Web.BackOffice/AspNetCore/AspNetCoreUmbracoApplicationLifetime.cs
+++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreUmbracoApplicationLifetime.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Hosting;
using Umbraco.Net;
-namespace Umbraco.Web.AspNet
+namespace Umbraco.Web.Common.AspNetCore
{
public class AspNetCoreUmbracoApplicationLifetime : IUmbracoApplicationLifetime
{
diff --git a/src/Umbraco.Web.Common/Extensions/UmbracoRequestServiceCollectionExtensions.cs b/src/Umbraco.Web.Common/Extensions/UmbracoRequestServiceCollectionExtensions.cs
deleted file mode 100644
index 2a16b8b4f9..0000000000
--- a/src/Umbraco.Web.Common/Extensions/UmbracoRequestServiceCollectionExtensions.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Umbraco.Web.Common.Middleware;
-
-namespace Umbraco.Web.Common.Extensions
-{
- public static class UmbracoRequestServiceCollectionExtensions
- {
- public static IServiceCollection AddUmbracoRequest(this IServiceCollection services)
- {
- var umbracoRequestLifetime = new UmbracoRequestLifetime();
-
- services.AddSingleton(umbracoRequestLifetime);
- services.AddSingleton(umbracoRequestLifetime);
-
- return services;
- }
-
- }
-
-}
diff --git a/src/Umbraco.Web.Common/Runtime/Profiler/WebInitialComponent.cs b/src/Umbraco.Web.Common/Runtime/Profiler/WebInitialComponent.cs
new file mode 100644
index 0000000000..2194b3c038
--- /dev/null
+++ b/src/Umbraco.Web.Common/Runtime/Profiler/WebInitialComponent.cs
@@ -0,0 +1,18 @@
+using Umbraco.Core.Composing;
+
+namespace Umbraco.Web.Common.Runtime.Profiler
+{
+ public sealed class WebInitialComponent : IComponent
+ {
+
+
+ public void Initialize()
+ {
+ }
+
+ public void Terminate()
+ {
+ }
+
+ }
+}
diff --git a/src/Umbraco.Web.Common/Runtime/Profiler/WebInitialComposer.cs b/src/Umbraco.Web.Common/Runtime/Profiler/WebInitialComposer.cs
new file mode 100644
index 0000000000..472d8bf8e9
--- /dev/null
+++ b/src/Umbraco.Web.Common/Runtime/Profiler/WebInitialComposer.cs
@@ -0,0 +1,24 @@
+using Microsoft.AspNetCore.Http;
+using Umbraco.Core;
+using Umbraco.Core.Composing;
+using Umbraco.Net;
+using Umbraco.Web.Common.AspNetCore;
+using Umbraco.Web.Common.Middleware;
+
+namespace Umbraco.Web.Common.Runtime.Profiler
+{
+ public class WebInitialComposer : ComponentComposer, ICoreComposer
+ {
+
+ public override void Compose(Composition composition)
+ {
+ base.Compose(composition);
+
+ var umbracoRequestLifetime = new UmbracoRequestLifetime();
+
+ composition.RegisterUnique(factory => umbracoRequestLifetime);
+ composition.RegisterUnique(factory => umbracoRequestLifetime);
+ composition.RegisterUnique();
+ }
+ }
+}
diff --git a/src/Umbraco.Web.UI.NetCore/Startup.cs b/src/Umbraco.Web.UI.NetCore/Startup.cs
index 444b9a835d..8a04b0b17b 100644
--- a/src/Umbraco.Web.UI.NetCore/Startup.cs
+++ b/src/Umbraco.Web.UI.NetCore/Startup.cs
@@ -24,7 +24,6 @@ namespace Umbraco.Web.UI.BackOffice
{
services.AddUmbracoConfiguration();
- services.AddUmbracoRequest();
services.AddUmbracoCore();
services.AddUmbracoWebsite();
}
diff --git a/src/Umbraco.Web.UI.NetCore/appsettings.json b/src/Umbraco.Web.UI.NetCore/appsettings.json
index 1c89647efa..2448ae0aa9 100644
--- a/src/Umbraco.Web.UI.NetCore/appsettings.json
+++ b/src/Umbraco.Web.UI.NetCore/appsettings.json
@@ -12,6 +12,9 @@
"AllowedHosts": "*",
"Umbraco": {
"CMS": {
+ "Hosting": {
+ "Debug": true
+ },
"Imaging": {
"Resize": {
"MaxWidth": 5000,