Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JimmyPun610/666c6ceedf7a9efbe9bb1aefb0e513c5 to your computer and use it in GitHub Desktop.
Save JimmyPun610/666c6ceedf7a9efbe9bb1aefb0e513c5 to your computer and use it in GitHub Desktop.

1. Follow Microsoft's guide to install dotnet core in the ubuntu server

https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#1604-

2. Prepare your app in ubuntu which makes below command is workable

sudo dotnet yourapp.dll

3. Create a service file in ubuntu

cd /etc/systemd/system
sudo nano yourapp.service

4. Modify and put below configuration in yourapp.service,

[Unit]
Description={My application description}

[Service]
WorkingDirectory={/usr/share/myapp}
ExecStart=/usr/bin/dotnet {/usr/share/myapp/myapp.dll}
SyslogIdentifier={myapp}
User=www-data

[Install]
WantedBy=multi-user.target

5. Enable service

sudo systemctl enable myapp

6. Reload systemctl daemon and start service

sudo systemctl daemon-reload
sudo systemctl start myapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment