配置文件升级+修改(重要更新!)

This commit is contained in:
2025-06-09 09:22:59 +08:00
parent a548d8f3f2
commit d111c8c2c0
27 changed files with 1880 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
using Nacos.AspNetCore.V2;
using System.Text.Json.Serialization;
using ZR.Admin.WebApi.AutoMapperProfile;
using ZR.Admin.WebApi.Extensions;
@@ -14,9 +15,12 @@ using ZR.Common.Cache;
using ZR.Common.MqttHelper;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
//配置中心
//builder.Configuration.AddNacosV2Configuration(builder.Configuration.GetSection("NacosConfig"));
//服务注册
//builder.Services.AddNacosAspNet(builder.Configuration);
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

View File

@@ -36,6 +36,9 @@
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="Lazy.Captcha.Core" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.7" />
<PackageReference Include="nacos-sdk-csharp" Version="1.3.10" />
<PackageReference Include="nacos-sdk-csharp.AspNetCore" Version="1.3.10" />
<PackageReference Include="nacos-sdk-csharp.Extensions.Configuration" Version="1.3.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NPOI" Version="2.7.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />

View File

@@ -16,5 +16,17 @@
"QualityOfServiceLevel": "AtLeastOnce"
}
]
},
"NacosConfig": {
"Listeners": [
{
"Optional": false,
"DataId": "MesServerConfig",
"Group": "DEFAULT_GROUP"
}
],
// 服务注册必填参数
"ServerAddresses": [ "http://127.0.0.1:8848" ], // Nacos 服务器地址
"Namespace": "" // 命名空间(默认 public
}
}