Thursday, July 21, 2011

Debugging a windows Service

Though there are different ways to debug your code in windows service, I have often preferred to modify my default Program.cs class like:


static class Program
{
///
/// The main entry point for the application.
///

static void Main()
{
#if (!DEBUG)
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new LISService()
};
ServiceBase.Run(ServicesToRun);
#else
LISService lis = new LISService();
lis.Start();
#endif
}
}

No comments:

Post a Comment