public static async Task Main(string[] args) { var build = CustomWebHostBuilder.Create <Startup>(args).Build(); try { await build.RunAsync(); } finally { await build.StopAsync(); } }
public static void Main(string[] args) { var build = CustomWebHostBuilder.Create <Startup>(CustomWebHostBuilder.AppCommonRoutingFileSettings, args).Build(); var logger = (ILogger <IWebHost>)build.Services.GetService(typeof(ILogger <IWebHost>)); try { logger.LogInformation($"{nameof(Main)}: build running..."); build.Run(); } catch (Exception ex) { logger.LogError("Fatal Error", ex); throw; } finally { logger.LogInformation($"{nameof(Main)}: build stopping..."); build.StopAsync(); } }