9

Microsoft has defined the IHostLifetime interface for WorkerServices to run as services on different platforms. (You can create a Worker Service project with dotnet new worker in the console).

If you want to run them as system services, you can use the extensions from Microsoft for systemd and Windows Services (See Nuget Windows Service and Systemd).

Is there already an implementation for MacOS (e.g. launchd) or would I need to do that one for myself if I want to support MacOS with my service, too?


See also https://github.com/dotnet/core/blob/58b0c128d2672bada008d6e2b9e5b29ae70c2c4c/release-notes/3.0/api-diff/Asp.Net/3.0.0_Microsoft.Extensions.Hosting.Systemd.md

and https://levelup.gitconnected.com/net-core-worker-service-as-windows-service-or-linux-daemons-a9579a540b77

2
  • 1
    Doesn't seem that way. Wonder how hard it would be to implement some of the stuff in github.com/dotnet/runtime/tree/main/src/libraries/… Commented May 14, 2021 at 9:05
  • 2025 here, still a very relevant question (it wasn't easy to find that question). I think I am going to bounty your question. Commented Feb 5 at 13:21

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.