v3.4.6
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using JNPF.API.Entry.Handlers;
|
||||
using JNPF.Common.Cache;
|
||||
using JNPF.Common.Core;
|
||||
using JNPF.Common.Core.Filter;
|
||||
using JNPF.Common.Core.Handlers;
|
||||
using JNPF.Common.Security;
|
||||
@@ -26,87 +27,88 @@ namespace JNPF.API.Entry;
|
||||
|
||||
public class Startup : AppStartup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.ConfigureMvcController();
|
||||
|
||||
// SqlSugar
|
||||
//services.SqlSugarConfigure();
|
||||
services.ConfigureSqlSugar();
|
||||
|
||||
// 注册EventBus服务
|
||||
services.ConfigureEventBus();
|
||||
|
||||
// 注册远程请求
|
||||
services.AddRemoteRequest();
|
||||
|
||||
// 视图引擎
|
||||
services.AddViewEngine();
|
||||
|
||||
// 任务调度
|
||||
services.AddTaskScheduler();
|
||||
|
||||
// 脱敏词汇检测
|
||||
services.AddSensitiveDetection();
|
||||
|
||||
// WebSocket服务
|
||||
services.AddWebSocketManager();
|
||||
|
||||
// 微信
|
||||
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
|
||||
services.ConfigureLogging();
|
||||
services.ConfigureOSSService();
|
||||
|
||||
services.AddSchedule();
|
||||
|
||||
services.AddOverideVisualDev();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
{
|
||||
// 添加状态码拦截中间件
|
||||
app.UseUnifyResultStatusCodes();
|
||||
|
||||
// app.UseHttpsRedirection(); // 强制https
|
||||
app.UseStaticFiles();
|
||||
|
||||
#region 微信
|
||||
IRegisterService register = RegisterService.Start(senparcSetting.Value).UseSenparcGlobal();//启动 CO2NET 全局注册,必须!
|
||||
register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value);//微信全局注册,必须!
|
||||
#endregion
|
||||
|
||||
app.UseWebSockets();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseCorsAccessor();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseKnife4UI(options =>
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
options.RoutePrefix = "newapi"; // 配置 Knife4UI 路由地址,现在是 /newapi
|
||||
foreach (var groupInfo in SpecificationDocumentBuilder.GetOpenApiGroups())
|
||||
{
|
||||
options.SwaggerEndpoint("/" + groupInfo.RouteTemplate, groupInfo.Title);
|
||||
}
|
||||
});
|
||||
// 注册和配置Mvc和api服务
|
||||
services.ConfigureMvcController();
|
||||
|
||||
app.UseInject(string.Empty);
|
||||
// 注册和配置SqlSugar
|
||||
services.ConfigureSqlSugar();
|
||||
|
||||
//app.MapWebSocketManager("/api/message/websocket", serviceProvider.GetService<IMHandler>());
|
||||
app.MapWebSocketManager("/websocket", serviceProvider.GetRequiredService<IMHandler>());
|
||||
// 注册EventBus服务
|
||||
services.ConfigureEventBus();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
// 注册和配置日志服务
|
||||
services.ConfigureLogging();
|
||||
|
||||
// 注册和配置存储服务
|
||||
services.ConfigureOSSService();
|
||||
|
||||
// 任务调度
|
||||
//services.AddSchedule(options =>
|
||||
//{
|
||||
// options.AddPersistence<DbJobPersistence>();
|
||||
//});
|
||||
|
||||
// 任务调度
|
||||
services.AddTaskScheduler();
|
||||
|
||||
services.AddMemoryCache(); // 使用本地缓存必须添加
|
||||
services.AddConfigurableOptions<CacheOptions>();
|
||||
|
||||
// 微信
|
||||
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
|
||||
services.AddOverideVisualDev();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
||||
{
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
// 添加状态码拦截中间件
|
||||
app.UseUnifyResultStatusCodes();
|
||||
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
// app.UseHttpsRedirection(); // 强制https
|
||||
app.UseStaticFiles();
|
||||
|
||||
//serviceProvider.GetRequiredService<ITimeTaskService>().StartTimerJob();
|
||||
}
|
||||
#region 微信
|
||||
IRegisterService register = RegisterService.Start(senparcSetting.Value).UseSenparcGlobal();//启动 CO2NET 全局注册,必须!
|
||||
register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value);//微信全局注册,必须!
|
||||
#endregion
|
||||
|
||||
app.UseWebSockets();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseCorsAccessor();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
// 任务调度看板
|
||||
app.UseScheduleUI();
|
||||
|
||||
app.UseKnife4UI(options =>
|
||||
{
|
||||
options.RoutePrefix = "newapi"; // 配置 Knife4UI 路由地址,现在是 /newapi
|
||||
foreach (var groupInfo in SpecificationDocumentBuilder.GetOpenApiGroups())
|
||||
{
|
||||
options.SwaggerEndpoint("/" + groupInfo.RouteTemplate, groupInfo.Title);
|
||||
}
|
||||
});
|
||||
|
||||
app.UseInject(string.Empty);
|
||||
|
||||
//app.MapWebSocketManager("/api/message/websocket", serviceProvider.GetService<IMHandler>());
|
||||
app.MapWebSocketManager("/websocket", serviceProvider.GetRequiredService<IMHandler>());
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
|
||||
//serviceProvider.GetRequiredService<ITimeTaskService>().StartTimerJob();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user