ASP.NET Core 部署在centos上配置守护进程的一个问题

发布于 2022-09-05 09:40:07 字数 3173 浏览 29 评论 0

ASP.NET Core应用程序运行在shell之中是正常的。但是shell关闭网站也就没了。所以要配置守护进程。

用的是Supervisor

/etc/supervisor/supervisord.conf的最后一行已经改为

;files = conf.d/*.conf

/etc/supervisor/conf.d/WebApplication4.conf中的配置代码

[program:WebApplication4]
command = dotnet WebApplication4.dll  #要执行的命令
directory = /home/wwwroot/WebApplication4/ ; #命令执行的目录
environment = ASPNETCORE__ENVIRONMENT=Production #环境变量
user = root  #进程执行的用户身份
stopsignal = INT
autostart = true #是否自动启动
autorestart = true #是否自动重启
startsecs = 1 #自动重启间隔
stderr_logfile = /var/log/WebApplication4.err.log ; #错误日志文件
stdout_logfile = /var/log/WebApplication4.out.log ; #输出日志文件

运行

supervisord -c /etc/supervisor/supervisord.conf

结果

执行

ps -ef | grep WebApplication4

只显示

root     23948 23672  0 12:46 pts/0    00:00:00 grep --color=auto WebApplication4

这么一条。没有dotnet

对应日志(我也不知有没有用)from /var/log/supervisor/supervisord.log

2017-06-05 22:31:50,023 CRIT Supervisor running as root (no user in config file)
2017-06-05 22:31:50,023 WARN No file matches via include "/etc/supervisord.d/*.ini"
2017-06-05 22:31:50,155 INFO RPC interface 'supervisor' initialized
2017-06-05 22:31:50,156 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-06-05 22:31:50,159 INFO daemonizing the supervisord process
2017-06-05 22:31:50,159 INFO supervisord started with pid 1825
2017-06-05 22:35:40,411 CRIT Supervisor running as root (no user in config file)
2017-06-05 22:35:40,411 WARN No file matches via include "/etc/supervisord.d/*.ini"
2017-06-05 22:35:40,411 INFO RPC interface 'supervisor' initialized
2017-06-05 22:35:40,411 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-06-05 22:35:40,412 INFO supervisord started with pid 1825
2017-06-05 22:50:51,008 CRIT Supervisor running as root (no user in config file)
2017-06-05 22:50:51,011 WARN No file matches via include "/etc/supervisord.d/*.ini"
2017-06-05 22:50:51,241 INFO RPC interface 'supervisor' initialized
2017-06-05 22:50:51,241 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-06-05 22:50:51,244 INFO daemonizing the supervisord process
2017-06-05 22:50:51,244 INFO supervisord started with pid 1824

其他地方也找不到什么日志了……

可能问题在这里,但我已经无能为力了。

2017-06-06 15:31:08,767 CRIT Supervisor running as root (no user in config file)
2017-06-06 15:31:08,767 WARN No file matches via include "/etc/supervisord.d/*.ini"

试过重启Supervisor也没有用

supervisorctl reload

请问我应该怎么做才能使 dotnet WebApplication4.dll 在守护进程中运行起来?

参考资料

http://www.cnblogs.com/ants/p...
http://xiaorui.cc/2015/12/21/...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

安静 2022-09-12 09:40:07

要确保 配置文件 supervisord.conf 中的 dotnet WebApplication4.dll这条命令能够正确地跑起来。

直接运行这条命令显然是没用的……

另外删掉这两行,或者新建对应文件。

stderr_logfile = /var/log/WebApplication4.err.log ; #错误日志文件
stdout_logfile = /var/log/WebApplication4.out.log ; #输出日志文件
太阳公公是暖光 2022-09-12 09:40:07

只有一条说明没启动起来呗,可以通过 ps -ef | grep supervisord 命令查看一下守护进程相关的进程,
然后如果没有启动起来在错误日志中肯定有相关信息,详细参考 http://siyouku.cn/article/686...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文