47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using Microsoft.Extensions.Logging.Configuration;
|
|
using Microsoft.Extensions.Logging.EventLog;
|
|
using ServicioGrupoSanchoToro;
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
//HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
|
|
//builder.Services.AddWindowsService(options =>
|
|
//{
|
|
// options.ServiceName = ".NET Joke Service";
|
|
//});
|
|
|
|
//LoggerProviderOptions.RegisterProviderOptions<
|
|
// EventLogSettings, EventLogLoggerProvider>(builder.Services);
|
|
|
|
//builder.Services.AddSingleton<JokeService>();
|
|
//builder.Services.AddHostedService<WindowsBackgroundService>();
|
|
|
|
//IHost host = builder.Build();
|
|
//host.Run();
|
|
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
bdGrupoSanchoToro.db.Utilidades.VersionPrograma = tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version");
|
|
var host = CreateHostBuilder(args).Build();
|
|
host.Run();
|
|
}
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|
Host.CreateDefaultBuilder(args)
|
|
.ConfigureServices((hostContext, services) =>
|
|
{
|
|
IConfiguration configuration = hostContext.Configuration;
|
|
|
|
Configuracion options = configuration.GetSection("Configuracion").Get<Configuracion>();
|
|
|
|
services.AddSingleton(options);
|
|
services.AddWindowsService(options=>options.ServiceName="Servicio GrupoSanchoToro");
|
|
|
|
services.AddHostedService<Worker>();
|
|
});
|
|
}
|