7
votes

I have create a ServiceStack console application that works great, but of course, I have to leave it running after triggering it from a command prompt. I want to run this as a Windows Service.

I'm reviewing this wiki page which states that you can run SS as a Windows Service.

https://github.com/ServiceStack/ServiceStack/wiki/Self-hosting

I was not totally clear on how to do this. This StarterTemplate is referenced from 2 years ago. Do I clone this project and then copy my code into it?

https://github.com/ServiceStack/ServiceStack.Examples/tree/master/src/StarterTemplates/WinServiceAppHost

2

2 Answers

3
votes

The easiest way is to create a ServiceStack Windows Service Empty project in ServiceStackVS VS.NET Extension.

Otherwise you can clone the WinService project, and create a new Windows Service project from Visual Studio and copy the approach in Program.cs.

A more recent ServiceStack Windows Service project is the Razor Rockstars website running in a Windows Service Host, the template of which was based on the ServiceStack.Examples Starter template.

3
votes

I use topshelf to run a servicestack console app as a windows service. It works really well for me. https://github.com/Topshelf/Topshelf