.NET ServiceInstaller get too much time for uninstall services
- by rodnower
Hello, we have some Setup Project wrote in Visual Studio 2008 in C# that installs and uninstalls services with ServiceInstaller class.
When I install the services this don't get too much time, but when I uninstall with following code the process for each service get few seconds (and we have many services):
ServiceInstaller si = new ServiceInstaler();
string path = string.Format("/assemblypath={0}", strServiceExecutablePath);
string[] cmdline = { path };
InstallContext context = new InstallContext(string.Empty, cmdline);
si.Context = context;
si.ServiceName = strServiceName;
si.Uninstall(null);
Some one know why?
Here I want to ask some related question.
What difference between working of:
InstallUtill /u exePath
when it uninstall service
and:
sc delete serviceName
And why when I delete some record from registry from CurrentControlSet\services I still see the service in services.msc but with:
<Failed to read description. Error code:2
In description?
From where I need to delete service manually for delete it complitely?
Thank you for ahead.