.NET service fails to start during installation
I have a client/server service that depends on the .NET Framework. The client and server share the same assembly and since the client applications run from unknown locations the assembly is saved in the GAC.
The problem is how to start this service from a .msi installation file on a Windows Vista machine.
Since the service depends on an assembly in the GAC it cannot be installed in the ServiceControl section. This is because services are started before files are committed to the GAC during the installation sequence. I solved this problem under WinXP by running a custom action after InstallFinalize. The custom action simply executes "cmd.exe /c NET START myservice". Yes I understand that I don't have confirmation of whether or not this command succeeds but it's the best I could come up with.
The problem is that this command fails under Windows Vista with an Access Denied error. I believe it is because the command does not run with elevated privileges. The installer already asks for elevated privileges but they don't get extended to this command for some reason.
The end result is that the user has to bring up the services control console and start the service themselves after the installation completes which is not an acceptable solution.
How can I start a managed service from a .msi file under Windows Vista?
-David Ashton

