1

I'm having a problem publishing and deploying my backend on centos.

First related to publishing the backend. Below attached a picture of the project of my web API.

enter image description here

I am not sure if this is the correct wayI've published them by using this code below:

dotnet publish -c debug -r linux-x64 --self-contained

on each one of the folders except the Test. So I have 3 published projects.

I then transfer it to my centos 7 servers using scp. Then I open the published OamrBackend.Web server and give permission to the app using chmod 777 ./OamrBackend.Web and then run it.

This is what it shows: enter image description here

(I am not sure if this is the correct way)

When trying to access this API from my PC it shows a page error This site can’t be reached ERR_CONNECTION_REFUSED.

What was the error here? Is it the way I try to publish is incorrect or they deploy was incorrect?

Daniel
  • 109
  • 1
  • 13
  • 1
    What address are you using to try to reach the API? – JuanR Feb 24 '22 at 02:55
  • @JuanR Im using my own computer and then I want to try the webapi so I use my chrome and then type the address:5001/api/gateway to get the list of gateway from the api. – Daniel Feb 24 '22 at 04:18
  • 1
    The app seems to be running you need to configure NGNIX to do X FORWARD headers and to pass the request to the kestrel server. – Jonathan Alfaro Feb 24 '22 at 04:29
  • 1
    most likely the kestrel server is only listening locally and not on the public interface – Jonathan Alfaro Feb 24 '22 at 04:31
  • I suggest you read this on how to publish asp.net core to a linux server: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-6.0 – Jonathan Alfaro Feb 24 '22 at 04:34
  • 2
    Also read this on how to bind to "non local host": https://stackoverflow.com/questions/34212765/how-do-i-get-the-kestrel-web-server-to-listen-to-non-localhost-requests – Jonathan Alfaro Feb 24 '22 at 04:37
  • Also you do NOT need to publis all 3 folders... You just need to publish 1 project which is the web app – Jonathan Alfaro Feb 24 '22 at 04:39

0 Answers0