A Self-hosted OWIN Windows Service project template that is easier to run and debug than the default Windows Service project template
A Debuggable, Self-Installing, Self-Hosted OWin Windows Service Template based on James Michael Hare’s excellent blogposts:
DebuggableOwinService
(see screenshot below)OnStart()
, OnStop()
, OnPause()
, OnContinue()
, OnShutDown()
and OnCustomCommand()
methodsApp.Config
for the correct hostname/port informationMyApp.exe -install
to install your service; now you can start/stop/pause your service. To uninstall your service simply run MyApp.exe -uninstall
.The WindowsService.cs
file contains the ServiceImplementation
class which, as it’s name suggests, implements all service methods. This class has been fitted with an WindowsServiceAttribute
which you can use to control some service-specific properties like Name
, DisplayName
, Description
, UserName
, Password
, EventLogSource
, StartMode
, CanPauseAndContinue
, CanShutdown
, CanStop
and services your service depends on via ServiceDependsOn
.
Sure! No problem. I can recommend the excellent Topshelf project, also available as NuGet package. This allows for even more control, has way better documentation and is also available on GitHub!
Works (tested) with: