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.

46 lines
1.5 KiB
C#

using Autofac;
using Autofac.Extensions.DependencyInjection;
using DS.Module.AutofacModule;
using DS.Module.HangfireModule;
using DS.Module.RedisModule;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.JobServiceApi;
using NLog.Web;
var builder = WebApplication.CreateBuilder(args);
//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
builder.Configuration
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
.Build();
builder.Configuration.AddEnvironmentVariables();
builder.Logging.AddNLog("nlog.config");
// Add services to the container.
//Autofacע<63><D7A2>
builder.Host
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureContainer<ContainerBuilder>(builder => { builder.RegisterModule(new AutofacModuleRegister()); });
builder.Services.AddUserModuleInstall(); //<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
builder.Services.AddRedisModuleInstall();//redis
builder.Services.AddSqlSugarInstall();
builder.Services.AddSaasDbInstall();//<2F>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
builder.Services.AddWorkServiceHangfireModuleInstall();//Hangfire<72><65><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD> BackgroundService <20>д<EFBFBD><D0B4><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
builder.Services.Configure<HostOptions>(hostOptions =>
{
hostOptions.BackgroundServiceExceptionBehavior = BackgroundServiceExceptionBehavior.Ignore;
}); //Ӧ<><D3A6><EFBFBD><EFBFBD>Ϊ Windows <20><><EFBFBD><EFBFBD>
builder.Services.AddWindowsService();
var app = builder.Build();
//app.UseHangfireMiddleware();
//<2F><EFBFBD>м<EFBFBD><D0BC><EFBFBD>
app.UseMiddleware<ExceptionHandlingMiddleware>();
//app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
app.Run();