开发完成ABP应用,需要部署在阿里云轻量级服务器上,需要将ABP应用作为后台服务运行。首先在/etc/systemd/system目录中创建新文件kestrel-zldnnapp.service,代码如下:
[Unit]
Description=ZLDNN ABP App
[Service]
WorkingDirectory=/dotnet/zldnn
ExecStart=/dotnet/zldnn/ZLDNN.OrderManagement.Web
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=zldnn
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
然后运行:
sudo systemctl enable kestrel-zldnnapp.service
启动服务并查看运行状态:
sudo systemctl start kestrel-zldnnapp.service
sudo systemctl status kestrel-zldnnapp.service
服务就部署完成了。如果需要更新应用,需要将服务停止。
网友评论