| | |
| | | using WIDESEA_Core.Helper; |
| | | //using WIDESEA_Core.HostedService; |
| | | using WIDESEA_Core.Middlewares; |
| | | using WIDESEA_WMSServer.BackgroundServices; |
| | | using WIDESEA_WMSServer.Filter; |
| | | |
| | | var builder = WebApplication.CreateBuilder(args); |
| | | |
| | | builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder => |
| | | { |
| | | builder.RegisterModule<AutofacModuleRegister>();//带有接口层的服务注入 |
| | | builder.RegisterModule<AutofacModuleRegister>();//���нӿڲ�ķ���ע�� |
| | | builder.RegisterModule<AutofacPropertityModuleReg>();// |
| | | }).ConfigureAppConfiguration((hostingContext, config) => |
| | | { |
| | |
| | | }); ; |
| | | 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();//读取配置文件 |
| | | builder.Services.AddMemoryCacheSetup();//缓存 |
| | | // 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.AddWebSocketSetup(); |
| | | builder.Services.AddSqlsugarSetup();//SqlSugar 启动服务 |
| | | builder.Services.AddDbSetup();//Db 启动服务 |
| | | builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入 |
| | | //builder.Services.AddHostedService<PermissionDataHostService>();//数据权限 |
| | | builder.Services.AddSqlsugarSetup();//SqlSugar �������� |
| | | builder.Services.AddDbSetup();//Db �������� |
| | | builder.Services.AddInitializationHostServiceSetup();//Ӧ�ó�ʼ������ע�� |
| | | builder.Services.AddHostedService<AutoOutboundTaskBackgroundService>(); |
| | | //builder.Services.AddHostedService<PermissionDataHostService>();//����Ȩ�� |
| | | builder.Services.AddAutoMapperSetup(); |
| | | |
| | | builder.Services.AddCorsSetup(); |
| | |
| | | options.Filters.Add(typeof(ActionExecuteFilter)); |
| | | }); |
| | | |
| | | builder.Services.AddScoped<HttpClientHelper>(); |
| | | |
| | | builder.Services.AddAuthorizationSetup(); |
| | | |
| | | builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit限流 启动服务 |
| | | builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit���� �������� |
| | | |
| | | 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 |
| | | //app.UseRecordAccessLogsMiddle(); |
| | | |
| | | app.UseCors(AppSettings.Get(new string[] { "Cors", "PolicyName" })); |
| | | |
| | | DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions(); |
| | | defaultFilesOptions.DefaultFileNames.Clear(); |
| | |
| | | |
| | | app.UseRouting(); |
| | | |
| | | app.UseCors(AppSettings.Get(new string[] { "Cors", "PolicyName" })); |
| | | |
| | | app.UseAuthentication(); |
| | | app.UseAuthorization(); |
| | | |