parental-control/client/ParentalControlService/Program.cs
2024-11-19 20:29:33 +01:00

21 lines
781 B
C#

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();