Agregar archivos de proyecto.
This commit is contained in:
46
ServicioGrupoSanchoToro/Program.cs
Normal file
46
ServicioGrupoSanchoToro/Program.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
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>();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user