redis启用新增配置
This commit is contained in:
parent
a0f4afbe25
commit
d13d7666ab
@ -8,6 +8,7 @@ using ZR.Admin.WebApi.Extensions;
|
|||||||
using ZR.Admin.WebApi.Filters;
|
using ZR.Admin.WebApi.Filters;
|
||||||
using ZR.Admin.WebApi.Middleware;
|
using ZR.Admin.WebApi.Middleware;
|
||||||
using ZR.Admin.WebApi.Hubs;
|
using ZR.Admin.WebApi.Hubs;
|
||||||
|
using ZR.Common.Cache;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@ -32,7 +33,8 @@ builder.Services.AddCors(c =>
|
|||||||
.AllowAnyMethod();//允许任意方法
|
.AllowAnyMethod();//允许任意方法
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
// 显示logo
|
||||||
|
builder.Services.AddLogo();
|
||||||
//注入SignalR实时通讯,默认用json传输
|
//注入SignalR实时通讯,默认用json传输
|
||||||
builder.Services.AddSignalR();
|
builder.Services.AddSignalR();
|
||||||
//消除Error unprotecting the session cookie警告
|
//消除Error unprotecting the session cookie警告
|
||||||
@ -65,10 +67,12 @@ builder.Services.AddTaskSchedulers();
|
|||||||
DbExtension.AddDb(builder.Configuration);
|
DbExtension.AddDb(builder.Configuration);
|
||||||
|
|
||||||
//注册REDIS 服务
|
//注册REDIS 服务
|
||||||
Task.Run(() =>
|
var openRedis = builder.Configuration["RedisServer:open"];
|
||||||
|
if (openRedis == "1")
|
||||||
{
|
{
|
||||||
//RedisServer.Initalize();
|
RedisServer.Initalize();
|
||||||
});
|
}
|
||||||
|
|
||||||
builder.Services.AddMvc(options =>
|
builder.Services.AddMvc(options =>
|
||||||
{
|
{
|
||||||
options.Filters.Add(typeof(GlobalActionMonitor));//全局注册
|
options.Filters.Add(typeof(GlobalActionMonitor));//全局注册
|
||||||
@ -80,8 +84,6 @@ builder.Services.AddMvc(options =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddSwaggerConfig();
|
builder.Services.AddSwaggerConfig();
|
||||||
// 显示logo
|
|
||||||
builder.Services.AddLogo();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
InternalApp.ServiceProvider = app.Services;
|
InternalApp.ServiceProvider = app.Services;
|
||||||
@ -119,7 +121,6 @@ app.UseAddTaskSchedulers();
|
|||||||
//使用全局异常中间件
|
//使用全局异常中间件
|
||||||
app.UseMiddleware<GlobalExceptionMiddleware>();
|
app.UseMiddleware<GlobalExceptionMiddleware>();
|
||||||
|
|
||||||
|
|
||||||
//设置socket连接
|
//设置socket连接
|
||||||
app.MapHub<MessageHub>("/msgHub");
|
app.MapHub<MessageHub>("/msgHub");
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,7 @@
|
|||||||
},
|
},
|
||||||
//redis服务配置
|
//redis服务配置
|
||||||
"RedisServer": {
|
"RedisServer": {
|
||||||
|
"open": 0, //是否启用redis
|
||||||
"Cache": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=cache:",
|
"Cache": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=cache:",
|
||||||
"Session": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=session:"
|
"Session": "127.0.0.1:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=session:"
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user