I have a self-contained ASP.net core app which works fine when started via command line on Linux Ubuntu.
If I try to start the same app as a service, it starts but crashes immediately.
The service file looks like this:
[UNIT]Description=.....[Service]workingDirectory=/etc/www/apiExecStart=/etc/www/api/API.WebUser=root[Install]WantedBy=multi-user.target
Hint: I just used root as user for demo purposes. When going live this will be a dedicated user with limited rights. --> It also does not work with a specific user with limited rights.
The crash error message when doing service status is:
What could cause such a strange behavior and how to avoid it.