Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

I can't active kestrel service on Ubuntu 16.04 with "Exec format error"

$
0
0

I am new to .net core and Ubuntu.

I am following this guide: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-apache?tabs=aspnetcore2x

I am working with a clean ASP.NET core 2.0 MVC project.

My service configuration file:

[Unit]
Description=Sample

[Service]
WorkingDirectory=/var/aspnetcore/sample
ExecStart=/var/aspnetcore/sample/sample.dll
Restart=always
# Restart service after 10 seconds if dotnet service crashes
RestartSec=10
SyslogIdentifier=sample
User=root
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

When I check status of the service I got:

root@xxx:~# systemctl status kestrel-sample.service
● kestrel-sample.service - Sample
   Loaded: loaded (/etc/systemd/system/kestrel-sample.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2018-03-30 15:01:46 +07; 9s ago
  Process: 13773 ExecStart=/var/aspnetcore/sample/sample.dll (code=exited, status=203/EXEC)
 Main PID: 13773 (code=exited, status=203/EXEC)

More details:

journalctl -xn
-- Logs begin at Fri 2018-03-30 11:43:27 +07, end at Fri 2018-03-30 15:01:18 +07. --
Mar 30 15:01:16 sample.com systemd[1]: kestrel-sample.service: Service hold-off time over, scheduling restart.
Mar 30 15:01:16 sample.com systemd[1]: Stopped Sample.
-- Subject: Unit kestrel-sample.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit kestrel-sample.service has finished shutting down.
Mar 30 15:01:16 sample.com systemd[1]: Started Sample.
-- Subject: Unit kestrel-sample.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit kestrel-sample.service has finished starting up.
--
-- The start-up result is done.
Mar 30 15:01:16 sample.com systemd[13743]: kestrel-sample.service: Failed at step EXEC spawning /var/aspnetcore/sample/sample.dll: Exec format error
-- Subject: Process /var/aspnetcore/sample/sample.dll could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /var/aspnetcore/sample/sample.dll could not be executed and failed.
--
-- The error number returned by this process is 8.
Mar 30 15:01:16 sample.com systemd[1]: kestrel-sample.service: Main process exited, code=exited, status=203/EXEC
Mar 30 15:01:16 sample.com systemd[1]: kestrel-sample.service: Unit entered failed state.
Mar 30 15:01:16 sample.com systemd[1]: kestrel-sample.service: Failed with result 'exit-code'.

I noticed error "Exec format error" and google it. Still can't get it work. Please help!

Thanks,


Viewing all articles
Browse latest Browse all 9386

Trending Articles