Ocelot .NET API gateway: Failed to load API definition

42 Views Asked by At

I used Ocelot to build .Net API gateway. I combined the CatchAll style and Aggregate in my configuration and got the error when runing gateway:

enter image description here

Please help to guide me to fix the problem. Below is my Routing configuration. The first routing is used for aggregate request and the second is Catch All style:

"Routes": [  {
    "DownstreamPathTemplate": "/api/orderservice/Order/GeAllOrders",
    "DownstreamScheme": "https",
    "DownstreamHostAndPorts": [
    {
        "Host": "localhost",
        "Port": 7028
    }
    ],
    "UpstreamPathTemplate": "/api/orderservice/Order/GeAllOrders",
    "UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE" ],
    "Key": "GeAllOrders",
    "SwaggerKey": "orderservice",
},{
    "DownstreamPathTemplate": "/api/orderservice/{everything}",
    "DownstreamScheme": "https",
    "DownstreamHostAndPorts": [
    {
        "Host": "localhost",
        "Port": 7028
    }
    ],
    "UpstreamPathTemplate": "/api/orderservice/{everything}",
    "UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE" ],
    "SwaggerKey": "orderservice",
},]

If I remove the second route (Catch All style), the error was fixed. However, I want to use the Catch All style to reduce the configuration.

This is my source code.

0

There are 0 best solutions below