在Linux上用supervisor运行ASP.NET Core站点的一个坑
将一个ASP.NET Core站点在Linux服务器上以self-contained部署方式发布出来后,直接在终端上运行下面的命令,站点可以正常运行。
/data/AboutUs/bin/Debug/netcoreapp1.0/ubuntu.14.04-x64/publish/AboutUs
但是通过supervisor以服务方式运行却失败:
# supervisorctl status
aboutus FATAL Exited too quickly (process log may have details)
查看错误日志发现是因为找不到appsettings.json文件:
# supervisorctl tail aboutus
'appsettings.json' was not found and is not optional.
at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
可appsettings.json文件明明就在那里。
在supervisor中是这样配置这个服务的( /etc/supervisor/conf.d/aboutus.conf ):
[program:aboutus]
command=/data/AboutUs/bin/Debug/netcoreapp1.0/ubuntu.14.04-x64/publish/AboutUs
autostart=true
autorestart=true
stderr_logfile=/var/log/aboutus.err.log
stdout_logfile=/var/log/aboutus.out.log
environment=Hosting__Environment=Production
user=root
stopsignal=INT
redirect_stderr=true
和在终端中运行的命令没区别,为什么在supervisor中以服务运行就不行呢?
。。。
后来想到,既然找不到appsettings.json文件,肯定是没在"/data/AboutUs/bin/Debug/netcoreapp1.0/ubuntu.14.04-x64/publish"这个路径中找,那我把当前路径设为这个路径也许能解决问题,于是在"/etc/supervisor/conf.d/aboutus.conf"添加了如下的1行配置:
directory=/data/AboutUs/bin/Debug/netcoreapp1.0/ubuntu.14.04-x64/publish
重启supervisor服务之后,问题解决。
# service supervisor restart
Restarting supervisor: supervisord.
# supervisorctl status
aboutus RUNNING pid 1941, uptime 0:00:02
[相关博文]
在Linux上用supervisor运行ASP.NET Core站点的一个坑的更多相关文章
- 在Linux上以服务的方式运行ASP.NET Core站点
更新:用supervisor是更好的解决方法,详见 Linux下为 dotnet 创建守护进程 要在生成环境下在Linux服务器上跑ASP.NET Core站点,首先要解决的问题是以服务的方式运行AS ...
- .NET跨平台之旅:在Linux上以本地机器码(native)运行ASP.NET Core站点
在将“.NET跨平台之旅”示例站点 about.cnblogs.com 从 ASP.NET 5 RC1 升级至 ASP.NET Core 1.0 (博文链接)之后,我们有一个难以抗拒的冲动 —— 体验 ...
- 在 Mac OS 上创建并运行 ASP.NET Core 1.0 网站
var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...
- 002.Create a web API with ASP.NET Core MVC and Visual Studio for Windows -- 【在windows上用vs与asp.net core mvc 创建一个 web api 程序】
Create a web API with ASP.NET Core MVC and Visual Studio for Windows 在windows上用vs与asp.net core mvc 创 ...
- 在IIS上发布并运行ASP.NET Core
英文原文地址:https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Application ...
- 翻译 - ASP.NET Core 托管和部署 - 在 Linux 上使用 Nginx 托管 ASP.NET Core 网站
翻译自 https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-5.0 本文介 ...
- 关于 IIS 上运行 ASP.NET Core 站点的“HTTP 错误 500.19”错误
昨天回答了博问中的一个问题 —— “HTTP 错误 500.19 - Internal Server Error dotnetcore”,今天在这篇随笔中时候事后诸葛亮地小结一下. 服务器是 Wind ...
- Docker在Linux上运行NetCore系列(三)在Linux上使用Docker运行Asp.NetCore
转发请注明此文章作者与路径,请尊重原著,违者必究. 系列文章:https://www.cnblogs.com/alunchen/p/10121379.html 开始说明 上几篇文章都是通过Linux运 ...
- 在 Mac 上通过 Docker 运行 Asp.net Core 简易教程
首先,你需要在 Mac 上安装好 Docker 下载地址 https://download.docker.com/mac/stable/Docker.dmg 或者查看别人的 安装教程 怎么安装这里就不 ...
随机推荐
- iOS判断数组不为空
用([array count]==0 )来判断是否为空,都是坑,如果array为空的话,执行count就会直接报错,程序崩溃退出. 正确判断NSArray是否为空的方法: if(array != ni ...
- orale 函数大全[转]
oracle函数大全 http://wenku.baidu.com/link?url=bXaGsnn8iN264GB8ec48IUPg5eRGDKAyAiSw0OBKL1I0mBVG549-2u9HT ...
- 自动生成Model层中对应表的各个字段
select 'public '+ case t.name when 'varchar' then 'string' when 'smallint' then 'Int16' when 'int' t ...
- idea 从github下载项目提示 file name too long 的解决方案
1.找到git shell命令行 2运行如下命令 git config --global core.longpaths true 附地址https://github.com/Strider-CD/st ...
- 【Java学习笔记】静态导入
package p2; //import static java.util.Collections.max; import java.util.ArrayList; import static jav ...
- HDU Math Problems
1576 const int mod = 9973; n = a - a / mod * mod; a / b = ans; ans * b = a = a / mod * mod + n; n = ...
- nodejs中标准包的制作,上传,安装及卸载方法
一:如何制作一个标准包? 为了规范化,基本遵循CommonJS规范,首先约定: 包的使用: 所有模块放在一个文件夹(包名) 包放在当前项目中的node_modules文件夹下 包中定义一个index. ...
- Linux echo, sort, sed 等一些命令总结
linux echo, sort, sed是初学linux shell script 的一些常用的命令.基本上来说,如果能够掌握了这些命令,我们就能写出一些不错的linux脚本.以下是我遇到的以下常用 ...
- Popup - 弹出层
//图片类快捷弹出层 <a href="" target="_blank"> <div class="panlifang1" ...
- set命令
set命令简介 set命令是shell中初学者比较少接触,但是却很有用的一个命令(这里我们说的shell指的是bash).set命令是shell解释器的一个内置命令,用来设置shell解释器的属性,从 ...