Watch this video , I had the same question. It also shows you how to debug a service.
Here are his instructions using the basic Windows C # service template in Visual Studio 2010/2012.
You add this to the Service1.cs file:
public void onDebug() { OnStart(null); }
You change your Main () to call your service this way if you are in the Active Solution DEBUG configuration.
static void Main() { #if DEBUG
Keep in mind that for now this is a great way to debug your service. It does not call OnStop() unless you explicitly call it similar to the way we called OnStart(null) in the onDebug() function.
Cesar Jun 24 '13 at 2:14 2013-06-24 02:14
source share