发布好的asp.net core mvc项目,
如果想在window或linux下的以控制台程序启动的话,可以用下面的命令
dotnet MyProject.dll --urls="https://localhost:7001;http://localhost:7000" --environment=Development
默认端口为5000(https为5001)
默认环境为Production
linux下,我们可以用supervisor来达到windows services的效果
supervisor简单使用:
/etc/supervisor/conf.d/xxx.conf
[program: xxx]
command=dotnet xxx.dll
directory=/home/wwwroot/www.xxx.com/
autorestart=true
autostart=true
stderr_logfile=/home/wwwroot/www.xxx.com/Logs/xxx.err.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stdout_logfile=/home/wwwroot/www.xxx.com/Logs/xxx.out.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
environment=ASPNETCORE_ENVIRONMENT=Production,ASPNETCORE_URLS="https://localhost:6001;http://localhost:6000"
user=root
stopsignal=INT
startsecs=3
修改配置文件后,使新配置文件生效
supervisorctl update xxx
superversorctl help查看使用说明,有以下命令可以使用
# supervisorctl help default commands (type help <topic>):
=====================================
add exit open reload restart start tail
avail fg pid remove shutdown status update
clear maintail quit reread signal stop version
监控日志输出情况:
supervisorctl tail -f xxx [stdout|stderr] 相关文章:
https://www.cnblogs.com/felixzh/p/6099961.html