作者:海伦国际官2502862377 | 来源:互联网 | 2023-06-17 16:56
创建项目dotnetnewmvc-o.app1cdapp1#启动dotnetrun发布项目发布项目:dotnetpublish-ooutput-cRelease安装supervis
创建项目
dotnet new mvc -o ./app1
cd app1
# 启动
dotnet run
发布项目
发布项目:dotnet publish -o /output -c Release
安装supervisor
yum install supervisor
systemctl start supervisord.service
如果supervisor启动异常,查看日志:
tail -f /var/log/messages
使用supervisor运行项目
touch /etc/supervisord.d/xxx.ini --添加一个项目的配置文件
systemctl restart supervisord.service
xxx.init中添加如下内容:
[program:app1]
directory=/root/dotnetdemo/app1/app1/bin/Debug/net6.0
command=dotnet app1.dll --urls "http://*:5000"
autostart=true
autorestart=true
stdout_logfile=/root/dotnetdemo/app1/app1/bin/Debug/net6.0/logs/out.log
stderr_logfile=/root/dotnetdemo/app1/app1/bin/Debug/net6.0/logs/err.log
创建日志文件:
如果不创建日志文件,启动会报错
touch /root/dotnetdemo/app1/app1/bin/Debug/net6.0/logs/out.log
touch /root/dotnetdemo/app1/app1/bin/Debug/net6.0/logs/err.log