This is a mirror of official site: http://jasper-net.blogspot.com/

Create a Windows Service in .NET That Can Also Run as Console Application

| Sunday, April 17, 2011
I’m creating a simple windows service using Visual Studio 2010 and .NET 4.  I want to be able to easily test it by simply running the resulting exe without the need to install the service.  I did some research on this topic and found three helpful articles:
  • HybridService: Easily Switch between Console Application and Service (on CodeProject)
  • Run Windows Service as a console program
  • Creating a windows service in visual studio 2010 (in VB)
I found that the first article was a bit more work than the second.  In the end, I pretty much combined the latter two articles’ approaches and created a simple template (in C#) that can be used as a starting point for any long-running windows service.  It’s still a work in progress, but I figure this will probably give some folks a head start and also is an opportunity for folks to tell me what I’m doing wrong.

To start, create a new Windows Service Project:

SNAGHTML14f68ce_1.png

Read more: Steve Smith

Posted via email from Jasper-net

0 comments: