Closed SeppPenner closed 8 months ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
After adding Environment=DOTNET_ROOT=/usr/share/dotnet
to the service file and doing a systemctl daemon-reload
, this issue is fixed. However, I wanted to know, why this issue can occur since dotnet is obviously installed correctly and it worked like this with .Net7 without any changes in particular to the code...
is the dotnet --info
you've provided from the host that's failing? How have you installed .NET on this host? Which packages and feeds specifically?
is the dotnet --info you've provided from the host that's failing?
Yes.
How have you installed .NET on this host? Which packages and feeds specifically?
Following https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-2204. So basically, just:
sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0
I guess, I found the issue: I didn't follow https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-2204, but https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian...
Describe the bug
.Net8 project (ASP.Net on base of background service) with
Microsoft.Extensions.Hosting.Systemd
fails with.NET location: Not found
onsystemctl start
.To Reproduce
Provide a .Net8 project with
Microsoft.Extensions.Hosting.Systemd
, add a service file (MyService.service
) to/etc/systemd/system
that looks like this, do asystemctl daemon-reload
and try to start the service usingsystemctl start MyService
.Service file
Environment file
Exceptions (if any)
Further technical details
Runtime Environment: OS Name: ubuntu OS Version: 22.04 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/8.0.200/
.NET workloads installed: There are no installed workloads to display.
Host: Version: 8.0.2 Architecture: x64 Commit: 1381d5ebd2
.NET SDKs installed: 8.0.200 [/usr/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 8.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found: None
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download