How to run an already developed ASP.NET Core application on Ubuntu?

What is the easiest way to run an existing ASP.NET Core application on Ubuntu? I found this: https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction , but I'm stuck on this:enter image description here

I published the application and copied it to my Ubuntu, but I have no idea how I can run the application. Any help would be really appreciated.

+4
source share
1 answer

It really is as simple as doing:

dotnet path/to/your/application.dll

- - . doc, , , , Systemd.

  • , . /etc/systemd/system/myapp.service
  • , : :

    [Unit]
    Description=Example .NET Web API Application running on Ubuntu
    
    [Service]
    WorkingDirectory=/var/path/to/your/app
    ExecStart=/usr/bin/dotnet /var/path/to/your/app/hellomvc.dll
    Restart=always
    RestartSec=10  # Restart service after 10 seconds if dotnet service crashes
    SyslogIdentifier=dotnet-example
    User=www-data
    Environment=ASPNETCORE_ENVIRONMENT=Production 
    
    [Install]
    WantedBy=multi-user.target
    
  • :

    systemctl enable myapp.service
    
  • :

    systemctl start myapp.service
    
  • , :

    systemctl status myapp.service
    

, , , .

.. , . , -, Nginx, Microsoft Kestrel .

+3

Source: https://habr.com/ru/post/1675626/


All Articles