3

Good morning friends, I'm having problems to start the service that runs my aspnet core application, I pass the error log:


● 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'.

these are the instructions in the service file

[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

Greetings and already thank you very much

  • 1
    If you are going to vote negative, at least comment on why, I am not a fortune teller, I also think that I did not ask anything out of place ... – Gianluca Fiore Nov 13 '18 at 13:17

2 Answers2

2

I got the same problem and same error like yours. After 3 hours playing around, I solved it by removing the single quote ' at the WorkingDirectory. Yours is at ExecStart. Just remove the single quote at the end of ExecStart=/usr/bin/dotnet '/home/implementacion/MasterProduct.dll'. Then run

sudo systemctl daemon-reload
sudo systemctl restart <your_service_name>.service

It will work.

Tuan van Duong
  • 185
  • 4
  • 14
1

in case someone has the same problem, I found a temporary solution using

supervisord http://supervisord.org/

this application/daemon gives more information in regards to errors, it is easier to use.