ServiceController on Vista

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?
 
A

archimago

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top