.netubuntunginxpublishloopback

.net publish applicationUrl issues (ubuntu vm)


i have some problems trying to publish an .net core webapi on ubuntuServer on local VM

my problem is, when i publish my webapi application the applicationUrl dont change for the correct address, see the images below.

my steps,

i have create a new webapi (dotnet new webapi) webapi Folder

lauchSettings.json the lauchSettings of the project folder

/var/www/minhaapi <- publish directory my published directory

dotnet minhaapi.dll tying run the publishied so i need the listening on http://0.0.0.0:5000 and 5001, because the localhost block my external acess with loopback

ss -nltup the bind address. on 127.0.0.1 not onn 0.0.0.0

dotnet run on webapi project folder when i try to dotnet run on project folder i got the corretcly addres, and now i can acess out my vm, but when i try run on published i get the localhost instead of 0.0.0.0,

https://postimg.cc/qgDZhNH6

the command to publish dotnet publish -o /var/www/minhaapi thx for help !


Solution

  • Already solved the problem,

    on my service on /etc/systemd/system/minhaapi.service, i add this line Environment=ASPNETCORE_URLS=http://0.0.0.0:5000

    and work correctly !