gpt4 book ai didi

ubuntu - 尝试在 Ubuntu 16.04 下运行 asp .net core 应用程序时出现 core-dump 错误

转载 作者:行者123 更新时间:2023-12-03 17:28:54 25 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 16.04 下将我的 asp .net 核心应用程序作为服务运行。
我在 this 之后创建了服务配置文件

[Unit]
Description=TNW Main Service

[Service]
WorkingDirectory=/home/tnw
ExecStart=/usr/bin/dotnet /home/tnw/Tnw.MealsApi.dll
Restart=always
RestartSec=10
SyslogIdentifier=tnw
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production

[Install]
WantedBy=multi-user.target

我启用了我的服务:
sudo systemctl enable tnw.service

最后我尝试运行它,但我得到了异常:
● tnw.service - TNW Main Service Loaded: loaded (/etc/systemd/system/tnw.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: core-dump) since Tue 2019-09-10 12:57:20 CEST; 118ms ago
Process: 15160 ExecStart=/usr/bin/dotnet /home/tnw/Tnw.MealsApi.dll (code=dumped, signal=ABRT)
Main PID: 15160 (code=dumped, signal=ABRT)

Sep 10 12:57:20 server767126 systemd[1]: tnw.service: Unit entered failed state.
Sep 10 12:57:20 server767126 systemd[1]: tnw.service: Failed with result 'core-dump'.

当我手动运行此应用程序时,它工作正常。
sudo dotnet Tnw.MealsApi.dll

//编辑我在日记中发现以下异常:
 System.Net.Sockets.SocketException (13): Permission denied

最佳答案

按此使用 Downloads保存您的 dll 的文件夹.下面是.service的配置文件

[Unit]
Description=MyService in .NET
# Requires=xyz.service
# After=xyz.service

[Service]
Type=simple
ExecStart=/usr/bin/dotnet /home/linux/Downloads/MyService.dll

[Install]
WantedBy=multi-user.target

这条路径 /home/linux/Downloads/MyService.dll在您的情况下可能会有所不同。

然后运行
sudo systemctl daemon-reload

关于ubuntu - 尝试在 Ubuntu 16.04 下运行 asp .net core 应用程序时出现 core-dump 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57869495/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com