V10 - Reduce usage of temp AspNetCoreHostingEnvironment (#12270)

* Move MapPathWebRoot & MapPathContentRoot to extension methods.

* Set AspNetCoreHostingEnvironment ApplicationId without service provider.

* Drop some usages of TempHostingEnvironment

* Logging setup cleanup - AppDomainId has no value (it is always "1")

Creating new AppDomains isn't possible in .Net core.
Attempting to do so results in a platform exception.

A dotnet core process has a single AppDomain instance whose Id property
is always the integer 1.

* Setup logging without IHostingEnvironment

* Mark IUmbracoBuilder.BuilderHostingEnvironment obsolete
And remove internal usages.

* Typeloader no longer uses umbraco-types.list

* Added UmbracoHost - setup serilog two-stage init.

* Add ApplicationIdEnricher

* Defensive tweaks for those not using UmbracoHost

* Drop UmbracoHost static class

* Setup runtime logger without host builder extensions.

* Prevent RefreshingRazorViewEngine related explosions

* Filescoped namespaces for new classes.

* Apply suggestions from code review
This commit is contained in:
Paul Johnson
2022-04-25 15:27:53 +01:00
committed by GitHub
parent f9840ed4b1
commit 551f523079
24 changed files with 629 additions and 810 deletions

View File

@@ -1,7 +1,6 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Umbraco.Cms.Web.Common.Hosting;
namespace Umbraco.Cms.Web.UI
{
@@ -12,12 +11,9 @@ namespace Umbraco.Cms.Web.UI
.Build()
.Run();
public static IHostBuilder CreateHostBuilder(string[] args)
=> Host.CreateDefaultBuilder(args)
#if DEBUG
.ConfigureAppConfiguration(config => config.AddJsonFile("appsettings.Local.json", optional: true, reloadOnChange: true))
#endif
.ConfigureLogging(x => x.ClearProviders())
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureUmbracoDefaults()
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());
}
}