今天在ubuntu发直接运行命令dotnet /var/www/down/Down.Web.dll发现报错Value cannot be null. (Parameter 'connectionString') at Hangfire.MySql.MySqlStorage等.起初还以为是配置有问题,结果折腾大半天,发现appSettings.json里面的所有配置都未能正确读取.

在ubuntu终端直接运行会以当前工作目录为读取目录,所以导致读取appSettings.json出错,应该要转到程序所在目录再执行dotnet xxx.dll命令.

或者配置到supervisor,应该就可以了.配置如下:

[program:down]
command=dotnet /var/www/down/Down.Web.dll
directory=/var/www/down
autostart=true
autorestart=true
stderr_logfile=/var/www/logs/down.err.log
stdout_logfile=/var/www/logs/down.out.log
environment=ASPNETCORE__ENVIRONMENT=Production
user=root
stopsignal=INT

以上就是【ubuntu asp.net core读取appSettings.json问题】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论