.net core项目部署至信创环境
1.打包PowerShell中输入命令dotnet publish -c Release -r linux-x64 --self-contained false使用压缩软件打包为zip并上传至服务指定目录2.解压unzip QServices.zip3.启动 .net core API进入项目目录修改服务器端数据库连接字符串执行dotnet QServices.dll --urls http://0.0.0.0:80534.配置开机自动启动4.1 创建Systemd服务文件sudo vi /etc/systemd/system/QService.service写入配置[Unit] DescriptionQServices .NET Core API Afternetwork.target [Service] WorkingDirectory/opt/qapp/QServices ExecStart/usr/share/dotnet/dotnet /opt/qapp/QServices/GRSH.Qnu.Service.dll --urlshttp://0.0.0.0:8053 Restartalways RestartSec10 SyslogIdentifierQService Userroot EnvironmentASPNETCORE_ENVIRONMENTProduction EnvironmentDOTNET_PRINT_TELEMETRY_MESSAGEfalse StandardOutputjournal StandardErrorjournal [Install] WantedBymulti-user.target4.2 重启sudo systemctl daemon-reload4.3 启动服务sudo systemctl start QService4.4 设置开机自动启动sudo systemctl enable QService4.5 查看服务运行状态systemctl status QService4.6 查看日志查看最近日志journalctl -u QService查看实时日志该命令主要用于排查错误journalctl -u QService -f5.其他启动服务systemctl start QService停止服务systemctl stop QService重启服务systemctl restart QService查看状态systemctl status QService查看是否开机启动systemctl list-unit-files | grep QService