小编Man*_*oor的帖子

404 尝试将上游路径路由到 Ocelot 中的下游路径

在将传入的 http 请求转发到下游路径时,我正面临此警告/错误。

Ocelot.DownstreamRouteFinder.Middleware.DownstreamRouteFinderMiddleware:警告:requestId:80000025-0004-fd00-b63f-84710c7967bb,previousRequestId:没有先前的请求ID,消息:DownstreamRouteFinderMiddleware 设置管道错误。IDownstreamRouteFinder 返回错误代码:UnableToFindDownstreamRouteError 消息:无法匹配上游路径的路由配置:/getDepartment,动词:GET。

程序.cs

public class Program
{
    public static void Main(string[] args)
    {
        CreateWebHostBuilder(args).Build().Run();
    }

    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
       WebHost.CreateDefaultBuilder(args)
       .ConfigureAppConfiguration((host, config) =>
       {
           config.AddJsonFile("ocelot.json");
       })
    .UseStartup<Startup>();
}
Run Code Online (Sandbox Code Playgroud)

启动文件

public IConfiguration Configuration { get; }

public Startup(IConfiguration configuration)
{
    Configuration = configuration;
}

// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public …
Run Code Online (Sandbox Code Playgroud)

microservices .net-core api-gateway ocelot

12
推荐指数
1
解决办法
5888
查看次数

标签 统计

.net-core ×1

api-gateway ×1

microservices ×1

ocelot ×1