Last night at
ALL.NET someone asked about how do debug a windows service. What I typically do is create a winform with a start button and a stop button. In the Program.cs the Main method would look something like this.
static void Main(string[] args)
{
if(args.Contains("/console"))
{
Application.Run(new FormICreated());
}
else
{
ServiceBase.Run(serviceObject);
}
}
The Forms OnLoad Starts the code the service executes.
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Start();
ShowTrayBalloon("Services have been started", ToolTipIcon.Info);
The developer then just runs the executable with a /console behind it instead of starting the service. This allows them to attach to the process with Visual Studios.
I'm not going to spell everything out here but this is the general idea of how I do it.