Fixing: Error 1001. The specified service already exists
Description: This error occurred during a per user install. The install was using the installer classes for services. The application was installed for all users. When a second user ran the installer classes tried to install the service again. This is fixed by testing for the existence of the service and skipping the service install if it already exists.
Showing posts with label Service. Show all posts
Showing posts with label Service. Show all posts
Monday, August 25, 2008
Sunday, August 24, 2008
Code: Test For Service Existence
Code To Test For Service Existence
bool serviceExists = false;
foreach ( System.ServiceProcess.ServiceController serviceController in System.ServiceProcess.ServiceController.GetServices())
{
if (serviceController.ServiceName == "TwentyTwentyLiveService")
{
serviceExists = true;
}
}
bool serviceExists = false;
foreach ( System.ServiceProcess.ServiceController serviceController in System.ServiceProcess.ServiceController.GetServices())
{
if (serviceController.ServiceName == "TwentyTwentyLiveService")
{
serviceExists = true;
}
}
Subscribe to:
Posts (Atom)