21 lines
781 B
C#
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();
|