修改 Startup 加载 和Module 加载
This commit is contained in:
1 parent
c732ecb1d2
commit
c7fb447034
17 files changed
+462
-383
No files matched your search
+8
-15
@@ -10,17 +10,17 @@ public partial class Program
|
||||
|
||||
// IOC 注册:自动注册 ISingletonDependency / IScopedDependency / ITransientDependency,并执行所有 IStartup / IModule.AddModule
|
||||
// 模块服务注册阶段(等价于 builder.Services.AddStoreHub(builder.Configuration, builder.Environment),额外把配置/环境交给模块)
|
||||
builder.AddStoreHub();
|
||||
builder.AddStore();
|
||||
builder.Services.AddFreeSqlDB();
|
||||
// JWT 验证:注册 JwtBearer 认证 + 令牌服务 + OpenAPI Bearer 安全方案(配置节 Jwt)
|
||||
builder.Services.AddStoreHubJwt(builder.Configuration);
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.Configure<Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions>(options =>
|
||||
{
|
||||
// 兼容迁移的同步控制器:允许同步读写请求/响应 IO(旧 asmx 行为)
|
||||
options.AllowSynchronousIO = true;
|
||||
});
|
||||
//builder.Services.Configure<Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions>(options =>
|
||||
//{
|
||||
// // 兼容迁移的同步控制器:允许同步读写请求/响应 IO(旧 asmx 行为)
|
||||
// options.AllowSynchronousIO = true;
|
||||
//});
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||
builder.Services.AddApiVersioning(options =>
|
||||
@@ -34,13 +34,9 @@ public partial class Program
|
||||
options.SubstituteApiVersionInUrl = true;
|
||||
}).AddOpenApi();
|
||||
|
||||
#region DB
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
app.UseStore();
|
||||
// 初始化 KJD 迁移的静态提供者(MysqlUtils 连接提供 / 业务配置读取)
|
||||
//StoreHub.KJDWebService.Commons.AdoProvider.SetServiceProvider(app.Services);
|
||||
//StoreHub.KJDWebService.Commons.KJDConfig.SetConfiguration(app.Configuration);
|
||||
@@ -63,9 +59,6 @@ public partial class Program
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
// 模块管道装配阶段:执行所有 IModule.UseModule(Hangfire 看板、定时任务等),必须在 Run() 之前
|
||||
app.UseStoreHubModules();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
||||
Reference in new issue
Block a user