ASP.NET Core-Linux发布部署

编译运行项目:

  donet run
  dotnet run -c Release –Release版本
发布项目:dotnet publish -o /output -c Release
运行项目:dotnet xxx.dll //编译好的项目直接运行即可
后台运行项目:nohup dotnet xxx.dll & (ps:必须使用exit退出终端,否则后台进程会退出)

 

 

推荐使用supervisor运行项目:
yum install supervisor
systemctl start supervisord.service
touch /etc/supervisord.d/xxx.ini –添加一个项目的配置文件
systemctl restart supervisord.service

xxx.init中添加如下内容:

[program:coreweb1]
directory=/application/publish/CoreWeb
command=/usr/bin/dotnet /application/publish/CoreWeb/CoreWeb.dll
autostart=true
autorestart=true
stdout_logfile=/application/publish/logs/out.log
stderr_logfile=/application/publish/logs/err.log