c# - 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'
没有其他的。有人知道如何解决这个问题吗?
解决方案
您不能直接运行 DDL,您必须将其作为参数调用dotnet
像这样的东西:
ExecStart=/usr/bin/dotnet /var/path/to/your/app/hellomvc.dll
推荐阅读
- xml - XSLT 输出与 1.0 版重复
- reactjs - 如何使用 useEffect 获取数据?
- c# - 在 web api 方法 c# 中接受任何类型的数据
- python - 如何从给定的顶点索引列表生成边列表?
- python - 子类方法没有得到解决
- node.js - Jenkins 使用节点和 dwupload 模块执行返回错误:ca key too small
- python - 隐藏构面行或列标题
- android - 如何从 Firebase 实时数据库 onChildChanged Android 获取更改的数据?
- angular - 如何向 npm pack 添加版本号?
- python - 在 django 表单中输入重复的错误消息