How to host Windows Service on Ubuntu via mono-service and C#

This is a “getting started” tutorial that describes how to create, compile and host a service with basic functionality using Mono, C# and Ubuntu server

1 Create Standard Windows Service from Visual Studio templates

2 Change this code and compile in MonoDevelop

3 Now you have these files. I coppied them to tmp folder


4 Start using terminal

sudo mono-service -l:/tmp/myservice.lock /tmp/WindowsService1.exe

5 You can kill it. You can get id from lock file

sudo kill 6122

6 Log is stored in