首页 > 解决方案 > ASP .NET CORE 2.0 - 无法在 Debian 上启动服务

问题描述

我对 .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-coredebiansystemd

解决方案


您不能直接运行 DDL,您必须将其作为参数调用dotnet

像这样的东西:

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

推荐阅读