如何为.NET 6中的每个微服务实现不同的ocelot.json

问题描述 投票:0回答:1

我是

microservices
架构的新手,并且已经使用单个
ocelot.json
文件实现了微服务和 API 网关,如下图所示。

Project structure

您可以看到

ocelot.json
项目中有一个
Gateway.WebApi
文件,其中包含路线。

哪一个是处理此问题的更好选择?

  1. 单个
    ocelot.json
    适用于所有微服务
  2. 每个微服务
  3. 单个
    ocelot.json

我们可以为每个微服务做一些类似的事情吗?

    

asp.net .net microservices ocelot
1个回答
0
投票

builder.Configuration.AddJsonFile("ocelot.json", 可选: false, reloadOnChange: true); //Master相关API

builder.Configuration.AddJsonFile("ocelot2.json", optional: false, reloadOnChange: true);//短信服务相关API

builder.Configuration.AddJsonFile("ocelot3.json", optional: false, reloadOnChange: true);//用于登录注册相关API

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.