This commit is contained in:
parent
945c4a8d05
commit
590d5ab936
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
using Nacos.AspNetCore.V2;
|
using Nacos.AspNetCore.V2;
|
||||||
using Nacos.V2.DependencyInjection;
|
using Nacos.V2.DependencyInjection;
|
||||||
|
|
||||||
|
|
@ -12,11 +12,11 @@ namespace MicoService.Demo
|
||||||
|
|
||||||
|
|
||||||
#region Nacos
|
#region Nacos
|
||||||
// 配置 Nacos 配置中心
|
// 配置 Nacos 配置中心
|
||||||
builder.Host.UseNacosConfig("nacos");
|
builder.Host.UseNacosConfig("nacos");
|
||||||
builder.Services.AddNacosV2Config(builder.Configuration);
|
builder.Services.AddNacosV2Config(builder.Configuration);
|
||||||
|
|
||||||
// 配置 Nacos 注册发现
|
// 配置 Nacos 注册发现
|
||||||
builder.Services.AddNacosAspNet(builder.Configuration);
|
builder.Services.AddNacosAspNet(builder.Configuration);
|
||||||
builder.Services.AddNacosV2Naming(builder.Configuration);
|
builder.Services.AddNacosV2Naming(builder.Configuration);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace MicoService.Demo2.Controllers
|
namespace MicoService.Demo2.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MicoService.Demo2.Controllers
|
||||||
}
|
}
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 演示:读取 Nacos 配置中心配置
|
/// 演示:读取 Nacos 配置中心配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
using Nacos.AspNetCore.V2;
|
using Nacos.AspNetCore.V2;
|
||||||
using Nacos.V2.DependencyInjection;
|
using Nacos.V2.DependencyInjection;
|
||||||
|
|
||||||
|
|
@ -11,11 +11,11 @@ namespace MicoService.Demo2
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
#region Nacos
|
#region Nacos
|
||||||
// 配置 Nacos 配置中心
|
// 配置 Nacos 配置中心
|
||||||
builder.Host.UseNacosConfig("nacos");
|
builder.Host.UseNacosConfig("nacos");
|
||||||
builder.Services.AddNacosV2Config(builder.Configuration);
|
builder.Services.AddNacosV2Config(builder.Configuration);
|
||||||
|
|
||||||
// 配置 Nacos 注册发现
|
// 配置 Nacos 注册发现
|
||||||
builder.Services.AddNacosAspNet(builder.Configuration);
|
builder.Services.AddNacosAspNet(builder.Configuration);
|
||||||
builder.Services.AddNacosV2Naming(builder.Configuration);
|
builder.Services.AddNacosV2Naming(builder.Configuration);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue