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