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

Viacheslav A
1 min readJul 14, 2017

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

/tmp/WindowsService1.exe
/tmp/WindowsService1.exe.config

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

/var/log/syslog

--

--

Viacheslav A

Software developer, Prague, Czech Republic. I’m doing my best in software engineering. Clouds, .NET CORE, Java, JavaScript.