Created
March 7, 2019 16:47
-
-
Save thanhdevapp/03184ea440d77c1e0001f13ef519f6e6 to your computer and use it in GitHub Desktop.
Create service dotnet core linux hosting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1: run command | |
sudo vi /etc/systemd/system/yourservice.service | |
2. copy paste to file | |
[Unit] | |
Description=Example .NET Web API App running on Ubuntu | |
[Service] | |
WorkingDirectory=[pathrootofhost] | |
ExecStart=/usr/bin/dotnet /home/[youruser]/public_html/tci.server.dll --urls http://0.0.0.0:5002 | |
Restart=always | |
# Restart service after 10 seconds if the dotnet service crashes: | |
RestartSec=10 | |
KillSignal=SIGINT | |
SyslogIdentifier=dotnet-example | |
User=www-data | |
Environment=ASPNETCORE_ENVIRONMENT=Production | |
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false | |
[Install] | |
WantedBy=multi-user.target | |
3. start service | |
sudo systemctl start yourservice.service | |
sudo systemctl status yourservice.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment