1

I have a problem with .Net Core ConsoleApp. I am trying to run it on DebianOS 9.0 as daemon. As far I did: 1. Create app in Visual Studio. 2. Publish app from Visual Studio fox x64-linux 3. Copy code to DebianOS 4. Create service in /etc/systemd/system/newservice.service

Code of my service looks like:

[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

When i try to run it with systemctl start newservice.service The return of this command is something like:

'newservice.service: Main process exited, code=exited, status=203/EXEC'

Nothing else. Someone have idea how to resolve this?

k1dl3r
  • 103
  • 1
  • 2
  • 11

2 Answers2

2

You cannot run the DDL directly, you have to call it as parameter of dotnet

Something like this :

ExecStart=/usr/bin/dotnet /var/path/to/your/app/hellomvc.dll
greyxit
  • 693
  • 3
  • 13
  • 1
    Thanks, work like a charm. What about if i have Self-Contained application not Framework-Dependent? – k1dl3r Jul 30 '18 at 09:14
  • https://stackoverflow.com/questions/40226032/running-self-contained-asp-net-core-application-on-ubuntu – greyxit Jul 30 '18 at 09:35
  • Ok, but doesn't explain me how to run it as a service. As far as I know the only difference is that i should remove `/usr/bin/dotnet` from ExecStart and it should run? I want to start service on boot of system, so I add it to `/etc/init.d/` and i have the same **Exec/203** – k1dl3r Jul 31 '18 at 08:48
  • The service is the same as the one you created, just remove the /path/to/dotnet, and replace the .dll by the generated executable. – greyxit Jul 31 '18 at 09:28
0

For me: status=203/EXEC indicating the execution is not running correctly. Please check the path/location of the dotnet when you was installing, because it may not be in /usr/bin/dotnet. Double check the location of your dll as well.

Do something like below:

ExecStart=/root/dotnet6/dotnet /root/YourAppFolder/YourAppName.dll
Haryono
  • 2,184
  • 1
  • 21
  • 14