配置文件
This commit is contained in:
@@ -7,7 +7,6 @@ using JNPF.SpecificationDocument;
|
||||
using JNPF.TaskScheduler.Interfaces.TaskScheduler;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Nacos.AspNetCore.V2;
|
||||
using Senparc.CO2NET;
|
||||
using Senparc.CO2NET.RegisterServices;
|
||||
using Senparc.Weixin;
|
||||
@@ -50,7 +49,7 @@ public class Startup : AppStartup
|
||||
|
||||
services.AddMemoryCache(); // 使用本地缓存必须添加
|
||||
services.AddConfigurableOptions<CacheOptions>();
|
||||
// services.AddSingleton(typeof(ISingleton), typeof(RedisData));
|
||||
services.AddSingleton(typeof(ISingleton), typeof(RedisData));
|
||||
// 微信
|
||||
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||
@@ -58,14 +57,14 @@ public class Startup : AppStartup
|
||||
services.AddOverideVisualDev();
|
||||
|
||||
//定时任务
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
|
||||
//services.AddHostedService<TimedTaskBackgroundService>();
|
||||
//services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
|
||||
services.AddHostedService<TimedTaskBackgroundService>();
|
||||
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
|
||||
//var bgSvc = App.GetRequiredService<BackgroundService>();
|
||||
//bgSvc.StartAsync(CancellationToken.None);
|
||||
//services.AddHostedService<RedisBackGround>();
|
||||
services.AddHostedService<RedisBackGround>();
|
||||
|
||||
services.AddNacosAspNet(App.Configuration, "Nacos");
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +113,6 @@ public class Startup : AppStartup
|
||||
endpoints.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
SnowflakeIdHelper.InitYitIdWorker();
|
||||
|
||||
bool isStartTimeJob = App.GetConfig<bool>("IsStartTimeJob");
|
||||
if (isStartTimeJob)
|
||||
|
||||
Reference in New Issue
Block a user