【问题标题】:kestrel-hellomvc.service: Failed at step USER spawning /usr/bin/dotnet: No such processkestrel-hellomvc.service:在步骤 USER 生成 /usr/bin/dotnet 时失败:没有这样的过程
【发布时间】:2017-04-24 03:54:35
【问题描述】:

我正在按照教程https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction在Nginx上发布asp.net核心项目,前面的步骤似乎都成功了,但是

systemctl start kestrel-hellomvc.service
systemctl status kestrel-hellomvc.service

我明白了

kestrel-hellomvc.service - Example .NET Web API Application running on Ubuntu
   
Loaded: loaded (/etc/systemd/system/kestrel-hellomvc.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-04-24 03:12:42 UTC; 8s ago
Process: 4285 ExecStart=/usr/bin/dotnet /home/84999/Demo4/Demo4.dll (code=exited, status=217/USER)
Main PID: 4285 (code=exited, status=217/USER)

Apr 24 03:12:42 instance-5 systemd[1]: Started Example .NET Web API Application running on Ubuntu.
Apr 24 03:12:42 instance-5 systemd[4285]: kestrel-hellomvc.service: Failed at step USER spawning /usr/bin/dotnet: No such process
Apr 24 03:12:42 instance-5 systemd[1]: kestrel-hellomvc.service: Main process exited, code=exited, status=217/USER
Apr 24 03:12:42 instance-5 systemd[1]: kestrel-hellomvc.service: Unit entered failed state.
Apr 24 03:12:42 instance-5 systemd[1]: kestrel-hellomvc.service: Failed with result 'exit-code'.

有人知道解决办法吗,我好像没有/usr/bin/dotnet文件夹。

【问题讨论】:

    标签: deployment asp.net-core systemd


    【解决方案1】:

    我已经解决了,源文件夹的所有者应该是www-data,拥有755权限。 Apache 用户在 Ubuntu 上称为 www-data,在 CentOS 上称为 apache。因此,如果在 Ubuntu 上运行,请在 kestrel-hellomvc.service 中特别设置 User=www-data,感谢 Jeppe 的评论。

    另外,如果您之前在 /etc/systemd/system/gunicorn.service 中添加过用户,删除这些用户也可能会解决此问题。

    【讨论】:

    • Apache 用户在 Ubuntu 上称为 www-data,在 CentOS 上称为 apache。因此,如果在 Ubuntu 上运行,请在 kestrel-hellomvc.service 中特别设置 User=www-data
    【解决方案2】:

    在文件 /etc/systemd/system/gunicorn.service 中,我添加了用户。删除用户后问题得到解决。

    ...
    
    [Service]
    User="someuser"
    ...
    

    来源:https://superuser.com/questions/1156676/what-causes-systemd-failed-at-step-user-spawning-usr-sbin-opendkim-no-such-p

    【讨论】:

    • 默认用户是root FWIW :)
    【解决方案3】:

    如果您的服务文件中定义的用户不存在,无论对 Web 应用文件夹的权限如何,都会显示相同的错误消息。

    【讨论】:

    • 就是这样!如果您复制并粘贴通用 .service 文件,请记住更新 [Service] 部分中的 User=...。谢谢。
    【解决方案4】:

    几个小时后,我的答案是“yum reinstall systemd”

    【讨论】:

    • 为我工作,使用 journalctl -xe 时出错
    • 这是否安装了更新的版本?有更新吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-23
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 2018-06-12
    • 1970-01-01
    • 2023-03-05
    相关资源
    最近更新 更多