Sunday, July 24, 2011

'specified service has been marked for deletion error'

If a service has been uninstantiated from services.msc than it first needs to close services.msc window before installing it again.

Most peoples have been observed restarting system to fix this and as it is a common situation for services development, hopefully this post will save a few reboots.

Thursday, July 21, 2011

"Set Service Login" window during service installation from InstallUtil.exe

Often a prompt window named "Set Service Login" appears during windows service installation through "installUtil.exe" asking for user authentication

Best way to ignore it is by modifying properties in installer.cs class

-Change Account in ProcessInstaller to 'LocalSystem'
-And Start type in ServiceInstaller to 'Automatic'

It will work fine than.

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
}
}