C# ASP.NET CORE 2.0-无法在Debian上启动服务
我对.Net Core ConsoleApp有问题。我试图在Debianos9.0上作为守护进程运行它。据我所知: 1.在VisualStudio中创建应用程序。 2.从Visual Studio fox x64 linux发布应用程序 3.将代码复制到DebianOS 4.在/etc/systemd/system/newservice.service中创建服务 我的服务代码如下所示:C# ASP.NET CORE 2.0-无法在Debian上启动服务,c#,unix,.net-core,debian,systemd,C#,Unix,.net Core,Debian,Systemd,我对.Net Core ConsoleApp有问题。我试图在Debianos9.0上作为守护进程运行它。据我所知: 1.在VisualStudio中创建应用程序。 2.从Visual Studio fox x64 linux发布应用程序 3.将代码复制到DebianOS 4.在/etc/systemd/system/newservice.service中创建服务 我的服务代码如下所示: [Unit] Description=Test DefaultDependencies=no [Servic
[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'
没有别的了。有人知道如何解决这个问题吗?您不能直接运行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。