'500 Error in DotNet Core 3.1 with Ocelot Gateway

I'm implementing a gateway to work on Azure Portal. The problem is my Ocelot which works perfectly fine on localhost, but on Azure it always gives 500 Internal Error.

My Ocelot:

{
  "Routes": [
     {

      "DownstreamPathTemplate": "/api/AuthApi",

      "DownstreamScheme": "https",

      "DownstreamHostAndPorts": [

        {
          "Host": https://myazurenameapp.azurewebsites.net
        }
      ],

      "UpstreamPathTemplate": "/gateway/token",

      "UpstreamHttpMethod": [ "Post" ]
    }
  ],
  "GlobalConfiguration": {
    "Baseurl": https://mygatewayazureapp.azurewebsites.net
  }
}

Is there anything I need on Azure Portal?

Thanks for your feedback



Solution 1:[1]

Before publishing a microservice application in azure. We need to create a separate app service for each service and API gateway.

As normal, Publish it directly from the VS 2019. Change the endpoints from the local host to Azure endpoints in ocelot.json before publishing the operation.

Try to check the below things to avoid errors in azure:

  • In the Azure app service, enable https, if you enabled https in your project.

  • Kindly set a startup project as multiple projects and choose all projects in the list as start.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RajkumarMamidiChettu-MT