Search code examples
asp.net-core.net-coreasp.net-core-mvcasp.net-core-webapiasp.net-core-2.2

Publishing .net core 2.2 app online and configuration


I'm trying to publish .net core app online, however I'm not sure if I'm doing the publish procedure correctly.

This is the output of my publish:

enter image description here

When running the app locally this is the default view:

enter image description here

I'm not sure how to deploy the app online, I tried to push the files from the publish output but I'm getting this screen:

enter image description here

These are the application properties:

enter image description here

What am I doing wrong?


Solution

  • When you run the application locally, the URL has the controller/action route specified:

    https://localhost:44394/api/values

    But the error screen shot is a base URL without a route:

    http://api.mywebsite.com

    Try adding the route to the published website URL and see if you can reach your app that way:

    http://api.mywebsite.com/api/values

    There should be a way to make the base URL automatically route to the values controller. Bonus points if anyone knows how to do that.