centos7注册服务上传程序 注册Service
创建文件服务配置文件
vim /etc/systemd/system/tyw.service
********************************************************************
[Unit]
Description=TYWService_config
[Service]
WorkingDirectory=/home/netcore
ExecStart=/usr/bin/dotnet /home/netcore/TellYouWhere.dll
Restart=always
# Restart service after 30 seconds if the dotnet service crashes:
RestartSec=30
KillSignal=SIGINT
SyslogIdentifier=PasswordReminder
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
*********************************************************************
Description填该服务的描述，可随便填
WorkingDirectory填 ASP.net Core程序文件夹的路径
ExecStart填运行你的 ASP.net Core的命令，其实就是第六节中运行dot net程序的命令。
SyslogIdentifier填log标识
User填用户名，最好填权限大一点的用户。
执行以下命令启用该service
systemctl enable tyw.service
systemctl start tyw.service
systemctl stop tyw.service
systemctl status tyw -l