Search code examples
.netmononancy

.net core application as a service on ubuntu


Currently I have a web application that makes use of the NancyFx framework. I run this application on Ubuntu as a service using TopShelf on top of mono. In the last couple of days I've spent time playing with dotnet core and I am looking at moving the existing code to .net core. I'm having trouble finding documentation on how a .net core application can be run as a service, and more particularly an linux service. Can anyone point me in the right direction?


Solution

  • A service in Linux can just be a regular console application in .NET Core.

    To have it behaving like a daemon, handling start and stop, you can have a look at this answer:

    Killing gracefully a .NET Core daemon running on Linux

    You can use Microsoft.AspNetCore.Owin to self host the web application.

    ASP.NET Core has its own implementation of OWIN:

    https://docs.asp.net/en/latest/fundamentals/owin.html