I suppose you've written the service on your own?
One debug possibility:
1) Add a method to your service class like:
public partial class YourService : ServiceBase
{
public void DebugStart()
{
this.OnStart(null);
}
}
And the main should look like this, e.g.
static void Main()
{
if (System.Environment.UserInteractive)
{
#if DEBUG
YourService s = new YourService();
s.DebugStart();
bool run = true;
do
{
Thread.Sleep(1000);
} while(run);
s.Stop();
s.Dispose();
#endif
}
else
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new YourService()
};
ServiceBase.Run(ServicesToRun);
}
}
Instead of the dirty forever loop you could open a modal window. To stop the service and debug the service shutdown, set a breakpoint in the forever loop and set run = false.