resolves remaining PR comments

This commit is contained in:
Shannon
2020-03-24 12:11:46 +11:00
parent 139cd3935f
commit 2f8a85abe5
3 changed files with 8 additions and 8 deletions

View File

@@ -18,10 +18,11 @@ namespace Umbraco.Web.BackOffice.AspNetCore
{
get
{
var httpContext = _httpContextAccessor?.HttpContext;
// If session isn't enabled this will throw an exception so we check
var sessionFeature = _httpContextAccessor?.HttpContext?.Features.Get<ISessionFeature>();
var sessionFeature = httpContext?.Features.Get<ISessionFeature>();
return sessionFeature != null
? _httpContextAccessor?.HttpContext?.Session?.Id
? httpContext?.Session?.Id
: "0";
}
}

View File

@@ -137,10 +137,11 @@ namespace Umbraco.Web.BackOffice.AspNetCore
var ioHelper = new IOHelper(hostingEnvironment, globalSettings);
var logger = SerilogLogger.CreateWithDefaultConfiguration(hostingEnvironment,
new AspNetCoreSessionIdResolver(httpContextAccessor),
() => serviceProvider.GetService<IRequestCache>(), coreDebug, ioHelper,
// need to build a new service provider since the one already resolved above doesn't have the IRequestCache yet
() => services.BuildServiceProvider().GetService<IRequestCache>(), coreDebug, ioHelper,
new AspNetCoreMarchal());
var backOfficeInfo = new AspNetCoreBackOfficeInfo(configs.Global());
var backOfficeInfo = new AspNetCoreBackOfficeInfo(globalSettings);
var profiler = new LogProfiler(logger);
Current.Initialize(logger, configs, ioHelper, hostingEnvironment, backOfficeInfo, profiler);

View File

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Serilog;
using Umbraco.Core.Composing;
namespace Umbraco.Web.UI.BackOffice
@@ -15,9 +14,8 @@ namespace Umbraco.Web.UI.BackOffice
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); })
.UseUmbraco()
.UseSerilog();
.UseUmbraco();
}
}