Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thanhdevapp/03184ea440d77c1e0001f13ef519f6e6 to your computer and use it in GitHub Desktop.
Save thanhdevapp/03184ea440d77c1e0001f13ef519f6e6 to your computer and use it in GitHub Desktop.
Create service dotnet core linux hosting
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