You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using NewLife.Extensions.Hosting.AgentService;
|
|
|
|
using NewLife.Log;
|
|
|
|
using WorkerSynReport;
|
|
|
|
|
|
|
|
|
|
|
|
XTrace.UseConsole();
|
|
|
|
|
|
|
|
// 授权示例 Authorization example
|
|
|
|
if (!HslCommunication.Authorization.SetAuthorizationCode( "4c30051d-fb61-48c2-979b-2ff92a40faff" ))
|
|
|
|
{
|
|
|
|
Console.WriteLine( "Authorization failed! The current program can only be used for 8 hours!" );
|
|
|
|
return; // 激活失败应该退出系统
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IHost host = Host.CreateDefaultBuilder(args)
|
|
|
|
.ConfigureServices(services =>
|
|
|
|
{
|
|
|
|
services.AddScoped<IDb111Context>(a => new Db111ContextHttp("Data Source=172.18.4.111;Initial Catalog=CWSSHG;user=sa;password=123456;Encrypt=false;"));
|
|
|
|
services.AddScoped<IDbContextLocal>(a => new DbContextLocal("Data Source=172.18.4.130;Initial Catalog=CWSSHG;user=sa;password=123456;Encrypt=false;"));
|
|
|
|
services.AddScoped<IDbContextHttp>(a => new DbContextHttp("Data Source=192.168.202.22;Initial Catalog=CWSSHG;user=sa;password=Lanju@123;Encrypt=false;"));
|
|
|
|
|
|
|
|
services.AddHostedService<Worker>();
|
|
|
|
services.AddHostedService<AlrWorker>();
|
|
|
|
services.AddHostedService<Alr111Worker>();
|
|
|
|
// services.AddHostedService<ReportReadBackgroud>();
|
|
|
|
|
|
|
|
//services.AddHostedService<PclWorker>();
|
|
|
|
})
|
|
|
|
.UseAgentService(options =>
|
|
|
|
{
|
|
|
|
options.ServiceName = "报表数据";
|
|
|
|
options.DisplayName = "Worker服务测试";
|
|
|
|
options.Description = "Worker服务的应用";
|
|
|
|
})
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
await host.RunAsync();
|