parental-control/client/ParentalControlService/Program.cs

21 lines
781 B
C#
Raw Permalink Normal View History

2023-09-09 10:41:07 +02:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Logging.EventLog;
using Microsoft.Extensions.Logging;
using ParentalControlService;
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Services.AddWindowsService(options => {
options.ServiceName = "Marek Parental Control";
});
LoggerProviderOptions.RegisterProviderOptions<EventLogSettings, EventLogLoggerProvider>(builder.Services);
builder.Services.AddSingleton<ParentalControlSvc>();
builder.Services.AddHostedService<ParentalControlSvc>();
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
IHost host = builder.Build();
host.Run();