nginx 托管.net core的service文件

在 /etc/systemd/system/ 中新建一个服务文件site1.service

vim /etc/systemd/system/site1.service 

 

[Unit]
Description=Example .NET Web MVC Application running on Centos7

[Service]
WorkingDirectory=/var/www/testsite1
ExecStart=/usr/bin/dotnet /var/www/testsite1/xpl.dll
Restart=always
RestartSec=10  # Restart service after 10 seconds if dotnet service crashes
SyslogIdentifier=dotnet-example
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production 

[Install]
WantedBy=multi-user.target

 

 报错后运行命令

systemctl enable site1.service 
systemctl start site1.service 
systemctl status site1.service 

注意:如果检查到错误,需要修改 kestrel-ntmvc.service 文件,修改正确之后,需要运行以下命令重新启动:

systemctl daemon-reload
systemctl restart site1.service 

 

posted @ 2018-09-17 18:36  小胖脸  阅读(289)  评论(0编辑  收藏  举报