diff --git a/src/Umbraco.Core/Composing/Composition.cs b/src/Umbraco.Core/Composing/Composition.cs
index e248d9eaf3..c7842565f0 100644
--- a/src/Umbraco.Core/Composing/Composition.cs
+++ b/src/Umbraco.Core/Composing/Composition.cs
@@ -63,9 +63,9 @@ namespace Umbraco.Core.Composing
public IRuntimeState RuntimeState { get; }
// TODO: remove this once no longer required for functionality in Umbraco.Web.
- ///
- /// Gets the configurations.
- ///
+ ///
+ /// Gets the configurations.
+ ///
public Configs Configs { get; }
#endregion
diff --git a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs
index 49c4f224ee..3514a8557c 100644
--- a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs
+++ b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoBuilderExtensions.cs
@@ -17,41 +17,43 @@ namespace Umbraco.Tests.Integration.TestServerTest
///
///
///
- public static IUmbracoBuilder WithTestCore(this IUmbracoBuilder builder, TestHelper testHelper, LightInjectContainer container,
+ public static IUmbracoBuilder WithTestCore(this IUmbracoBuilder builder, TestHelper testHelper,
+ LightInjectContainer container,
Action dbInstallEventHandler)
{
return builder.AddWith(nameof(global::Umbraco.Web.Common.Builder.UmbracoBuilderExtensions.WithCore),
- () =>
- {
- builder.Services.AddUmbracoCore(
- builder.WebHostEnvironment,
- container,
- typeof(UmbracoBuilderExtensions).Assembly,
- AppCaches.NoCache, // Disable caches in integration tests
- testHelper.GetLoggingConfiguration(),
- // TODO: Yep that's extremely ugly
- (configs, globalSettings, connectionStrings, umbVersion, ioHelper, logger, profiler, hostingEnv, backOfficeInfo, typeFinder, appCaches, dbProviderFactoryCreator) =>
- {
- var runtime = UmbracoIntegrationTest.CreateTestRuntime(
- configs,
- globalSettings,
- connectionStrings,
- umbVersion,
- ioHelper,
- logger,
- profiler,
- hostingEnv,
- backOfficeInfo,
- typeFinder,
- appCaches,
- dbProviderFactoryCreator,
- testHelper.MainDom, // SimpleMainDom
- dbInstallEventHandler); // DB Installation event handler
+ () =>
+ {
+ builder.Services.AddUmbracoCore(
+ builder.WebHostEnvironment,
+ container,
+ typeof(UmbracoBuilderExtensions).Assembly,
+ AppCaches.NoCache, // Disable caches in integration tests
+ testHelper.GetLoggingConfiguration(),
+ // TODO: Yep that's extremely ugly
+ (configs, globalSettings, connectionStrings, umbVersion, ioHelper, logger, profiler, hostingEnv,
+ backOfficeInfo, typeFinder, appCaches, dbProviderFactoryCreator) =>
+ {
+ var runtime = UmbracoIntegrationTest.CreateTestRuntime(
+ configs,
+ globalSettings,
+ connectionStrings,
+ umbVersion,
+ ioHelper,
+ logger,
+ profiler,
+ hostingEnv,
+ backOfficeInfo,
+ typeFinder,
+ appCaches,
+ dbProviderFactoryCreator,
+ testHelper.MainDom, // SimpleMainDom
+ dbInstallEventHandler); // DB Installation event handler
- return runtime;
- },
- out _);
- });
+ return runtime;
+ },
+ out _);
+ });
}
}
}
diff --git a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
index 296f083659..ede121a9f7 100644
--- a/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
+++ b/src/Umbraco.Web.Common/AspNetCore/AspNetCoreHostingEnvironment.cs
@@ -10,24 +10,20 @@ namespace Umbraco.Web.Common.AspNetCore
{
public class AspNetCoreHostingEnvironment : Core.Hosting.IHostingEnvironment
{
- private readonly HostingSettings _hostingSettings;
+ private IOptionsMonitor _hostingSettings;
private readonly IWebHostEnvironment _webHostEnvironment;
private string _localTempPath;
public AspNetCoreHostingEnvironment(IOptionsMonitor hostingSettings, IWebHostEnvironment webHostEnvironment)
{
- _hostingSettings = hostingSettings.CurrentValue ?? throw new ArgumentNullException(nameof(hostingSettings));
+ _hostingSettings = hostingSettings ?? throw new ArgumentNullException(nameof(hostingSettings));
_webHostEnvironment = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
SiteName = webHostEnvironment.ApplicationName;
ApplicationId = AppDomain.CurrentDomain.Id.ToString();
ApplicationPhysicalPath = webHostEnvironment.ContentRootPath;
- //TODO how to find this, This is a server thing, not application thing.
- ApplicationVirtualPath = _hostingSettings.ApplicationVirtualPath?.EnsureStartsWith('/')
- ?? "/";
-
IISVersion = new Version(0, 0); // TODO not necessary IIS
}
@@ -37,8 +33,9 @@ namespace Umbraco.Web.Common.AspNetCore
public string ApplicationPhysicalPath { get; }
public string ApplicationServerAddress { get; }
- public string ApplicationVirtualPath { get; }
- public bool IsDebugMode => _hostingSettings.Debug;
+ //TODO how to find this, This is a server thing, not application thing.
+ public string ApplicationVirtualPath => _hostingSettings.CurrentValue.ApplicationVirtualPath?.EnsureStartsWith('/') ?? "/";
+ public bool IsDebugMode => _hostingSettings.CurrentValue.Debug;
public Version IISVersion { get; }
public string LocalTempPath
@@ -48,7 +45,7 @@ namespace Umbraco.Web.Common.AspNetCore
if (_localTempPath != null)
return _localTempPath;
- switch (_hostingSettings.LocalTempStorageLocation)
+ switch (_hostingSettings.CurrentValue.LocalTempStorageLocation)
{
case LocalTempStorage.AspNetTemp:
diff --git a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs
index dd91a2cca9..08b7670522 100644
--- a/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs
+++ b/src/Umbraco.Web.Common/Builder/UmbracoBuilderExtensions.cs
@@ -34,7 +34,7 @@ namespace Umbraco.Web.Common.Builder
{
options.ShouldProfile = request => false; // WebProfiler determine and start profiling. We should not use the MiniProfilerMiddleware to also profile
}));
-
+
public static IUmbracoBuilder WithMvcAndRazor(this IUmbracoBuilder builder, Action mvcOptions = null, Action mvcBuilding = null)
=> builder.AddWith(nameof(WithMvcAndRazor), () =>
{
diff --git a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
index 7afa4adf68..06b2d7b421 100644
--- a/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
+++ b/src/Umbraco.Web.Common/Extensions/UmbracoCoreServiceCollectionExtensions.cs
@@ -29,6 +29,8 @@ using Umbraco.Web.Common.AspNetCore;
using Umbraco.Web.Common.Profiler;
using ConnectionStrings = Umbraco.Core.Configuration.Models.ConnectionStrings;
using CoreDebugSettings = Umbraco.Core.Configuration.Models.CoreDebugSettings;
+using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment;
+using ILogger = Umbraco.Core.Logging.ILogger;
namespace Umbraco.Extensions
{
@@ -93,6 +95,28 @@ namespace Umbraco.Extensions
return services;
}
+ ///
+ /// Adds the Umbraco Back Core requirements
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static IServiceCollection AddUmbracoCore(
+ this IServiceCollection services,
+ IWebHostEnvironment webHostEnvironment,
+ IRegister umbContainer,
+ Assembly entryAssembly,
+ AppCaches appCaches,
+ ILoggingConfiguration loggingConfiguration,
+ out IFactory factory)
+ => services.AddUmbracoCore(webHostEnvironment, umbContainer, entryAssembly, appCaches, loggingConfiguration, GetCoreRuntime, out factory);
+
///
/// Adds the Umbraco Configuration requirements
///
@@ -184,6 +208,7 @@ namespace Umbraco.Extensions
Assembly.GetEntryAssembly(),
appCaches,
loggingConfig,
+ GetCoreRuntime,
out factory);
return services;
@@ -196,9 +221,10 @@ namespace Umbraco.Extensions
///
///
///
- ///
+ ///
///
///
+ /// Delegate to create ana
///
///
public static IServiceCollection AddUmbracoCore(
@@ -206,34 +232,10 @@ namespace Umbraco.Extensions
IWebHostEnvironment webHostEnvironment,
IRegister umbContainer,
Assembly entryAssembly,
- AppCaches appCaches,
+ AppCaches appCaches,
ILoggingConfiguration loggingConfiguration,
- out IFactory factory)
- => services.AddUmbracoCore(webHostEnvironment, umbContainer, entryAssembly, appCaches, loggingConfiguration, GetCoreRuntime, out factory);
-
-
- ///
- /// Adds the Umbraco Back Core requirements
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- /// Delegate to create an
- ///
- ///
- public static IServiceCollection AddUmbracoCore(
- this IServiceCollection services,
- IWebHostEnvironment webHostEnvironment,
- IRegister umbContainer,
- Assembly entryAssembly,
- AppCaches appCaches,
- ILoggingConfiguration loggingConfiguration,
- // TODO: Yep that's extremely ugly
- Func getRuntime,
+ //TODO: Yep that's extremely ugly
+ Func getRuntime,
out IFactory factory)
{
if (services is null) throw new ArgumentNullException(nameof(services));
@@ -267,7 +269,6 @@ namespace Umbraco.Extensions
var typeFinderSettings = serviceProvider.GetService>();
var dbProviderFactoryCreator = serviceProvider.GetRequiredService();
- var configs = serviceProvider.GetRequiredService();
CreateCompositionRoot(services,
globalSettings,
@@ -279,7 +280,8 @@ namespace Umbraco.Extensions
var umbracoVersion = new UmbracoVersion();
var typeFinder = CreateTypeFinder(logger, profiler, webHostEnvironment, entryAssembly, typeFinderSettings);
- var runtime = getRuntime(
+ var configs = serviceProvider.GetService();
+ var coreRuntime = getRuntime(
configs,
globalSettings.CurrentValue,
connectionStrings.Value,
@@ -293,7 +295,14 @@ namespace Umbraco.Extensions
appCaches,
dbProviderFactoryCreator);
- factory = runtime.Configure(container);
+ factory = coreRuntime.Configure(container);
+
+
+ services.Configure(hostingSettings =>
+ {
+ hostingSettings.Debug = false;
+ });
+
return services;
}
diff --git a/src/Umbraco.Web.UI.NetCore/Startup.cs b/src/Umbraco.Web.UI.NetCore/Startup.cs
index 72e0d792f3..aa141b2624 100644
--- a/src/Umbraco.Web.UI.NetCore/Startup.cs
+++ b/src/Umbraco.Web.UI.NetCore/Startup.cs
@@ -34,6 +34,7 @@ namespace Umbraco.Web.UI.NetCore
{
var umbracoBuilder = services.AddUmbraco(_env, _config);
umbracoBuilder.BuildWithAllBackOfficeComponents();
+
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
diff --git a/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj b/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj
index 3e1518abdd..c9421d2cb8 100644
--- a/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj
+++ b/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj
@@ -17,7 +17,7 @@
-
+