public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        .ConfigureServices((hostContext, services) =>
        {
            IConfiguration configuration = hostContext.Configuration;

            WorkerSettings options = configuration.GetSection("ServiceConfigurations").Get <WorkerSettings>();

            services.AddSingleton(options);
            services.AddHostedService <Worker>();
        }).UseWindowsService();
Beispiel #2
0
 public Worker(ILogger <Worker> logger, WorkerSettings settings)
 {
     _logger   = logger;
     _settings = settings;
 }