【问题标题】:ASP .NET CORE 2.0 - Unable to start service on DebianASP .NET CORE 2.0 - 无法在 Debian 上启动服务
【发布时间】:2018-07-30 08:05:07
【问题描述】:

.Net Core ConsoleApp 有问题。我正在尝试在 DebianOS 9.0 上将它作为守护进程运行。据我所知: 1. 在 Visual Studio 中创建应用程序。 2. 从 Visual Studio fox x64-linux 发布应用 3. 复制代码到 DebianOS 4.在/etc/systemd/system/newservice.service中创建服务

我的服务代码如下:

[Unit]
Description=Test
DefaultDependencies=no

[Service]
ExecStart=/var/SystemdExample/ConsoleApp.dll
WorkingDirectory=/var/SystemdExample
Restart=always
RestartSec=10
User=netuser
SyslogIdentifier=ConsoleAppEx
Group=netuser

[Install]
WantedBy=multi.user.target

当我尝试使用 systemctl start newservice.service 运行它时 这个命令的返回是这样的:

'newservice.service: Main process exited, code=exited, status=203/EXEC'

没有别的了。有人知道如何解决这个问题吗?

【问题讨论】:

    标签: c# unix .net-core debian systemd


    【解决方案1】:

    你不能直接运行DDL,你必须把它作为dotnet的参数调用

    类似这样的:

    ExecStart=/usr/bin/dotnet /var/path/to/your/app/hellomvc.dll
    

    【讨论】:

    • 谢谢,工作就像一个魅力。如果我有不依赖于框架的独立应用程序怎么办?
    • 好的,但没有向我解释如何将它作为服务运行。据我所知,唯一的区别是我应该从 ExecStart 中删除 /usr/bin/dotnet 并且它应该运行?我想在系统启动时启动服务,所以我将它添加到 /etc/init.d/ 并且我有相同的 Exec/203
    • 服务和你创建的一样,只是去掉/path/to/dotnet,将.dll替换成生成的可执行文件。
    【解决方案2】:

    对我来说: status=203/EXEC 表示执行没有正确运行。 请在安装时检查 dotnet 的路径/位置,因为它可能不在 /usr/bin/dotnet 中。 仔细检查你的 dll 的位置。

    执行以下操作:

    ExecStart=/root/dotnet6/dotnet /root/YourAppFolder/YourAppName.dll
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-03
      • 1970-01-01
      相关资源
      最近更新 更多