| | |
| | | |
| | | builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder => |
| | | { |
| | | builder.RegisterModule<AutofacModuleRegister>();//���нӿڲ�ķ���ע�� |
| | | builder.RegisterModule<AutofacPropertityModuleReg>();// |
| | | builder.RegisterModule<AutofacModuleRegister>(); // 注册接口依赖注入 |
| | | builder.RegisterModule<AutofacPropertityModuleReg>(); // 注册属性注入 |
| | | }).ConfigureAppConfiguration((hostingContext, config) => |
| | | { |
| | | hostingContext.Configuration.ConfigureApplication(); |
| | | config.Sources.Clear(); |
| | | config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); |
| | | }); ; |
| | | }); |
| | | builder.ConfigureApplication(); |
| | | |
| | | //App.ExpDateTime = DateTime.Parse("2025-03-31 00:00:00");//����ʱ�� |
| | | // App.ExpDateTime = DateTime.Parse("2025-03-31 00:00:00"); // 设置过期时间 |
| | | |
| | | // 2�����÷��� |
| | | builder.Services.AddSingleton(new AppSettings(builder.Configuration));//ע�� |
| | | builder.Services.AddAllOptionRegister();//��ȡ�����ļ� |
| | | // 2. 配置服务 |
| | | builder.Services.AddSingleton(new AppSettings(builder.Configuration)); // 注册配置 |
| | | builder.Services.AddAllOptionRegister(); // 获取配置文件 |
| | | builder.Services.AddSingleton<RoundRobinService>(); |
| | | builder.Services.Configure<AutoOutboundTaskOptions>( |
| | | builder.Configuration.GetSection("AutoOutboundTask")); |
| | | builder.Services.AddMemoryCacheSetup();//���� |
| | | builder.Services.AddMemoryCacheSetup(); // 缓存服务 |
| | | builder.Services.AddWebSocketSetup(); |
| | | builder.Services.AddSqlsugarSetup();//SqlSugar �������� |
| | | builder.Services.AddDbSetup();//Db �������� |
| | | builder.Services.AddInitializationHostServiceSetup();//Ӧ�ó�ʼ������ע�� |
| | | builder.Services.AddSqlsugarSetup(); // SqlSugar 数据库配置 |
| | | builder.Services.AddDbSetup(); // Db 数据库配置 |
| | | builder.Services.AddInitializationHostServiceSetup(); // 应用程序初始化服务注册 |
| | | builder.Services.AddHostedService<AutoOutboundTaskBackgroundService>(); |
| | | //builder.Services.AddHostedService<PermissionDataHostService>();//����Ȩ�� |
| | | // builder.Services.AddHostedService<PermissionDataHostService>(); // 权限数据服务 |
| | | builder.Services.AddAutoMapperSetup(); |
| | | |
| | | builder.Services.AddCorsSetup(); |
| | |
| | | |
| | | builder.Services.AddAuthorizationSetup(); |
| | | |
| | | builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit���� �������� |
| | | builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration); // IP限流 中间件注册 |
| | | |
| | | builder.Services.AddScoped<UseServiceDIAttribute>(); |
| | | |
| | |
| | | |
| | | builder.Services.AddControllers(o => |
| | | { |
| | | o.Filters.Add(typeof(GlobalExceptionsFilter));//ȫ���쳣 |
| | | o.Filters.Add(typeof(GlobalExceptionsFilter)); // 全局异常处理 |
| | | }) |
| | | .AddNewtonsoftJson(options => |
| | | { |
| | |
| | | |
| | | var app = builder.Build(); |
| | | |
| | | // 3�������� |
| | | app.UseMiniProfiler();//���ܷ����� |
| | | app.ConfigureApplication();//�����ļ� |
| | | app.UseApplicationSetup();//�������� |
| | | // 3. 配置中间件 |
| | | app.UseMiniProfiler(); // 性能分析 |
| | | app.ConfigureApplication(); // 应用配置 |
| | | app.UseApplicationSetup(); // 应用启动 |
| | | |
| | | app.UseAllServicesMiddle(builder.Services); |
| | | |
| | | app.UseSession(); |
| | | app.UseSwaggerAuthorized(); |
| | | app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html�ļ�")); |
| | | app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html文件不存在")); |
| | | app.UseIpLimitMiddle(); |
| | | app.UseApiLogMiddleware(); |
| | | //todo |