background preloader

2016

Facebook Twitter

Self Host ASP.NET Web API as Windows Service. In my previous blog I demonstrated how to Self Host ASP.NET Web API, which was a very basic console application leveraging Owin and Katana. The next step in this series is how to turn your console application into a Windows service. Windows Service Template The typical way to create a Windows Service is by using the Windows Service template when creating a new project within Visual Studio. The template will create a Program.cs calling ServiceBase.Run() in the Main() method. View the code on <a href=" SelfHostServiceBase is the code that will extend ServiceBase. View the code on <a href=" That’s simplest possible implementation. What this means is you must build your Windows service, start it, then attach the debugger to the process.

Doesn’t sound like a fun way to debug does it? Topself Topshelf is a framework for hosting services written using the .NET framework.