public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseWindowsService()
.UseContentRoot(AppContext.BaseDirectory)
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Worker>();
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>().UseKestrel(opt =>
{
//opt.ListenLocalhost(5088); 本地监听
opt.ListenAnyIP(5088);
});
}).ConfigureLogging((context, logging) =>
{
logging.ClearProviders();
logging.AddConsole();
logging.SetMinimumLevel(LogLevel.Trace);
}).UseNLog();