ServiceController on Vista

  • Thread starter Thread starter archimago
  • Start date Start date
A

archimago

I have an administrative program (installed by click-once) that starts/stops
a service running on the same machine.

The ServiceController class can check the status of the service, but as soon
as it attempts to start/stop the service on Vista which has UAC enabled (it
runs fine on XP and when UAC is disabled), I get this message:

Cannot open <servicename> service on computer <computername>. Access is denied

Presumably it's all about permissions. The application was installed as a
fully trusted click-once program, and is running under a user that has
administrative rights; the service is running under the LocalSystem account.

This is a very common scenario. Can someone point me towards a solution?
 
You have it in one. Everything I have seen leads me to be conclude that
ClickOnce applications are not appropriate, if one wants to use something
like ServiceController under Vista. I updated the application manifest to use
enhanced rights, built a bootstrap rather than a ClickOnce installation, and
everything worked fine under Vista with UAC (albeit with the expected
prompts).

Phil Wilson said:
I assume the issue is that it's irrelevant if you're an admin because you
still run with limited user rights, and apparently Vista elevation manifests
are not supported for ClickOnce web-deployed apps. See if this helps:

http://www.geektieguy.com/2007/08/2...work-for-web-deployed-clickonce-applications/

--
Phil Wilson
[MVP Windows Installer]


archimago said:
I have an administrative program (installed by click-once) that
starts/stops
a service running on the same machine.

The ServiceController class can check the status of the service, but as
soon
as it attempts to start/stop the service on Vista which has UAC enabled
(it
runs fine on XP and when UAC is disabled), I get this message:

Cannot open <servicename> service on computer <computername>. Access is
denied

Presumably it's all about permissions. The application was installed as a
fully trusted click-once program, and is running under a user that has
administrative rights; the service is running under the LocalSystem
account.

This is a very common scenario. Can someone point me towards a solution?
 
Back
Top