Shane
Shane

Reputation: 4315

How do i run a ServiceStack console project as a Windows Service?

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

Upvotes: 7

Views: 1765

Answers (2)

mythz
mythz

Reputation: 143369

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.

Upvotes: 3

MikeT
MikeT

Reputation: 827

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

Upvotes: 3

Related Questions