linux - 无法使用 SYSTEMCTL 在 ubuntu 16 服务器上实现 aspnet 核心
问题描述
朋友们早上好,我在启动运行我的 aspnet 核心应用程序的服务时遇到问题,我通过了错误日志:
● mproduct.service - Example .NET Web API Application running on Ubuntu
Loaded: loaded (/etc/systemd/system/mproduct.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since mar 2018-11-13 08:17:07 -03; 4s ago
Process: 28154 ExecStart=/usr/bin/dotnet /home/implementacion/MasterProduct.dll (code=exited, status=140)
Main PID: 28154 (code=exited, status=140)
nov 13 08:17:07 vps-1416160-x systemd[1]: mproduct.service: Main process exited, code=exited, status=140/n/a
nov 13 08:17:07 vps-1416160-x systemd[1]: mproduct.service: Unit entered failed state.
nov 13 08:17:07 vps-1416160-x systemd[1]: mproduct.service: Failed with result 'exit-code'.
nov 13 08:17:07 vps-1416160-x systemd[1]: mproduct.service: Service hold-off time over, scheduling restart.
nov 13 08:17:07 vps-1416160-x systemd[1]: Stopped Example .NET Web API Application running on Ubuntu.
nov 13 08:17:07 vps-1416160-x systemd[1]: mproduct.service: Start request repeated too quickly.
nov 13 08:17:07 vps-1416160-x systemd[1]: Failed to start Example .NET Web API Application running on Ubuntu.
nov 13 08:17:07 vps-1416160-x systemd[1]: mproduct.service: Unit entered failed state.
nov 13 08:17:07 vps-1416160-x systemd[1]: mproduct.service: Failed with result 'start-limit-hit'.
这些是服务文件中的说明
[Unit]
Description=Example .NET Web API Application running on Ubuntu
[Service]
WorkingDirectory=/home/implementacion
ExecStart=/usr/bin/dotnet '/home/implementacion/MasterProduct.dll'
Restart=always
RestartSec=10 # Restart service after 10 seconds if dotnet service crashes
SyslogIdentifier=dotnet-example
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
问候,已经非常感谢你
解决方案
我遇到了和你一样的问题和同样的错误。'
玩了 3 个小时后,我通过删除WorkingDirectory
. 你的在ExecStart
. 只需删除末尾的单引号即可ExecStart=/usr/bin/dotnet '/home/implementacion/MasterProduct.dll'
。然后运行
sudo systemctl daemon-reload
sudo systemctl restart <your_service_name>.service
它会起作用的。
推荐阅读
- javascript - 映射 2 对象数组并填充布尔数组
- authentication - MS Graph API - AADSTS50126:验证凭据时出错
- vuejs2 - 如何在 cypress 中使用 vue-select
- python - Pandas - 根据日期时间列的值创建一个新的字符串列
- python-sphinx - 构建 HTML 文件时文件名太长错误
- java - 在 setValue 之后 PDFBox 的 PDTextField 行为不一致
- bash - 检查整数是否是数组中的元素
- python - 如何将 spaCy 公开为 REST API?
- javascript - 嵌套 for 循环 - Javascript FreeCodeAcademy 问题
- database - 将 Redis 数据持久化到 Oracle 数据库而不是 Disk