public static Task Main(WebHostParameters webHostParameters) { var webHost = new WebHostBuilder() .ConfigureAppConfiguration((config) => { config.AddEmbeddedResource( new EmbeddedResourceConfigurationOptions { Assembly = Assembly.GetExecutingAssembly(), Prefix = "DemoApp.WebHost" }); }) .ConfigureServices((hostContext, services) => { services.AddSingleton <IHostLifetime, ConsoleLifetimePatch>(); }) .UseKestrel(options => { options.Listen(webHostParameters.ServerIpEndpoint); }) .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup <Startup>() .Build(); App.Host = webHost; return(webHost.RunPatchedAsync()); }