配置文件

This commit is contained in:
2024-04-12 09:55:26 +08:00
parent 64409b785b
commit c8e2f1eafd
4 changed files with 9 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{ {
"JobConnectionStrings": { "JobConnectionStrings": {
"ConfigId": "JNPF-Job", // 不可修改 "ConfigId": "JNPF-Job",// 不可修改
"DBName": "jnpf_sundial", "DBName": "jnpf_sundial",
"DBType": "SqlServer", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite; "DBType": "SqlServer", //MySql;SqlServer;Oracle;PostgreSQL;Dm;Kdbndp;Sqlite;
"Host": "192.168.0.214", "Host": "192.168.0.214",

View File

@@ -6,6 +6,8 @@ public class WebComponent : IWebComponent
public void Load(WebApplicationBuilder builder, ComponentContext componentContext) public void Load(WebApplicationBuilder builder, ComponentContext componentContext)
{ {
builder.Host.UseWindowsService(); builder.Host.UseWindowsService();
builder.Configuration.AddJsonFile("Location.json", optional: true, reloadOnChange: true);
//// 日志过滤 //// 日志过滤
//builder.Logging.AddFilter((provider, category, logLevel) => //builder.Logging.AddFilter((provider, category, logLevel) =>
//{ //{

View File

@@ -4,7 +4,7 @@
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": false, "launchBrowser": false,
"applicationUrl": "http://0.0.0.0:9212", "applicationUrl": "http://localhost:5000",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Production" "ASPNETCORE_ENVIRONMENT": "Production"
} }

View File

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