using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; using gswi.Configuration; using System; namespace gswi { public class Program { static void Main(string[] args) { try { Configuration.HostExtensions.ChangeCurrentDirToProjectDir(); var host = CreateHostBuilder(args).Build(); host.LogHostingEnvironment(); host.SeedData(); host.Run(); } catch (Exception ex) { Configuration.HostExtensions.LogStartError(ex); Console.WriteLine(ex.ToString()); } finally { NLog.LogManager.Shutdown(); } } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }).ConfigureLogging((hostCtx, loggingBuilder) => { loggingBuilder.SetMinimumLevel(LogLevel.Trace); loggingBuilder.AddNLog($"nlog-{hostCtx.HostingEnvironment.EnvironmentName}.config"); }); } }