From 695571c6009ecbc12e7d4a4fb147df7967a1260e Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 07 七月 2025 20:21:19 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
index 2df5516..2a5b7f2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs"
@@ -19,12 +19,13 @@
using WIDESEA_Core.Core;
using Autofac.Core;
using Microsoft.AspNetCore.Builder;
+using WIDESEA_Core.HostedService;
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder =>
{
- builder.RegisterModule(new AutofacModuleRegister());//带有接口层的服务注入
+ builder.RegisterModule<AutofacModuleRegister>();//带有接口层的服务注入
builder.RegisterModule<AutofacPropertityModuleReg>();//
}).ConfigureAppConfiguration((hostingContext, config) =>
{
@@ -34,15 +35,17 @@
}); ;
builder.ConfigureApplication();
+//App.ExpDateTime = DateTime.Parse("2025-05-31 00:00:00");
// 2、配置服务
builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注册
builder.Services.AddAllOptionRegister();//读取配置文件
builder.Services.AddMemoryCacheSetup();//缓存
+builder.Services.AddWebSocketSetup();
builder.Services.AddSqlsugarSetup();//SqlSugar 启动服务
-//builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入
builder.Services.AddDbSetup();//Db 启动服务
-
+//builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入
+builder.Services.AddHostedService<PermissionDataHostService>();//应用初始化服务注入
builder.Services.AddAutoMapperSetup();
builder.Services.AddCorsSetup();
@@ -57,6 +60,7 @@
builder.Services.AddMvc(options =>
{
options.Filters.Add(typeof(ApiAuthorizeFilter));
+ options.Filters.Add(typeof(ActionExecuteFilter));
});
builder.Services.AddAuthorizationSetup();
@@ -96,14 +100,17 @@
app.UseMiniProfiler();//性能分析器
app.ConfigureApplication();//配置文件
app.UseApplicationSetup();//启动配置
+
+app.UseAllServicesMiddle(builder.Services);
+
app.UseSession();
-//if (app.Environment.IsDevelopment())
+if (app.Environment.IsProduction())
{
//todo
- //app.UseSwaggerAuthorized();
- app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html"));
+ app.UseSwaggerAuthorized();
+
}//判断是否需要打开swagger
-
+app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEA_WMSServer.index.html") ?? throw new Exception("WIDESEA_WMSServer.index.html文件"));
app.UseIpLimitMiddle();
app.UseApiLogMiddleware();
//todo
--
Gitblit v1.9.3