将一个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

[相关博文]

ASP.NET Core重写个人博客站点小结

在Linux上用supervisor运行ASP.NET Core站点的一个坑的更多相关文章

  1. 在Linux上以服务的方式运行ASP.NET Core站点

    更新:用supervisor是更好的解决方法,详见 Linux下为 dotnet 创建守护进程 要在生成环境下在Linux服务器上跑ASP.NET Core站点,首先要解决的问题是以服务的方式运行AS ...

  2. .NET跨平台之旅:在Linux上以本地机器码(native)运行ASP.NET Core站点

    在将“.NET跨平台之旅”示例站点 about.cnblogs.com 从 ASP.NET 5 RC1 升级至 ASP.NET Core 1.0 (博文链接)之后,我们有一个难以抗拒的冲动 —— 体验 ...

  3. 在 Mac OS 上创建并运行 ASP.NET Core 1.0 网站

    var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...

  4. 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 创 ...

  5. 在IIS上发布并运行ASP.NET Core

    英文原文地址:https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Application ...

  6. 翻译 - 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 本文介 ...

  7. 关于 IIS 上运行 ASP.NET Core 站点的“HTTP 错误 500.19”错误

    昨天回答了博问中的一个问题 —— “HTTP 错误 500.19 - Internal Server Error dotnetcore”,今天在这篇随笔中时候事后诸葛亮地小结一下. 服务器是 Wind ...

  8. Docker在Linux上运行NetCore系列(三)在Linux上使用Docker运行Asp.NetCore

    转发请注明此文章作者与路径,请尊重原著,违者必究. 系列文章:https://www.cnblogs.com/alunchen/p/10121379.html 开始说明 上几篇文章都是通过Linux运 ...

  9. 在 Mac 上通过 Docker 运行 Asp.net Core 简易教程

    首先,你需要在 Mac 上安装好 Docker 下载地址 https://download.docker.com/mac/stable/Docker.dmg 或者查看别人的 安装教程 怎么安装这里就不 ...

随机推荐

  1. NOIp蒟蒻的爆零记——HA-0132

    考前: 从十一月开始的听课集训,连考六场:考前的最后两天写(da)着(zhe)各种各样的奇(C)葩(S)模板:一周的疯狂,已经过去: 考前的一晚:第二批高二的六个人聚在一起(还有滑稽大师),愉快的玩( ...

  2. Sql Server 2008卸载后再次安装一直报错

    sql server 2008卸载之后再次安装一直报错问题. 第一:由于上一次的卸载不干净,可参照百度完全卸载sql server2008 的方式 1. 用WindowsInstaller删除所有与S ...

  3. Ext开场表单布局设计

    var form = new Ext.form.FormPanel({ labelAlign: 'right', labelWidth: 60, buttonAlign: 'center', titl ...

  4. 设置secureCRT的鼠标右键为弹出文本操作菜单功能

    options菜单下的 global options 页面的 terminal 中的 mouse 子菜单对 paste  on  right button 的选项取消勾选即可.

  5. JS-身份证号获取出生日期、性别、年龄

    var cardId=$("#cardId").val();//先获取身份证号(据自己实际写法获取) 1.获取出生日期: function getBirth(cardId){ va ...

  6. 19. UIAlertController 提示框获取文本内容,打印控制台上

    1.首先定义一个全局字符串变量,方便接收获取的文本内容 2. -(void)viewDidAppear:(BOOL)animated{ UIAlertController * alert = [UIA ...

  7. Spring整合MyBatis

    前言:MyBatis 是支持普通 SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis 消除了几乎所有的JDBC代码和参数的手工设置以及结果集的检索.MyBatis 使用简单的XML或注解用 ...

  8. oracle官方文档12c对应关系

    ADDCI Oracle® Database Data Cartridge Developer's Guide 12c Release 1 (12.1) E15882-05 ADFNS Oracle® ...

  9. Python 性能优化——对象绑定

    不同函数调用方式对应不同的绑定次数: import profile class A: def f(self): pass def foo(): a = A() for i in range(10000 ...

  10. bdb log为什么 有 region buffer 和 log cursor buf

    对bdb log来说, 在共享内存中 有一块 buffer, 同时每一个 log cursor 都自带一个 malloc的buf. why? 我认为: region buffer存的是log最末尾, ...