tags:

views:

642

answers:

3

I am using a service controller in a win forms application to start and stop a service which listens to a message queue and processes the messages. I get an access denied error when the service is started from the win forms application.I am using Vista Home Basic and an account which is of type administrator and I have used Log As - Local System Account. The service can be started and stopped normally using the Service Management Console but I get an error when I try to Start the service programatically.Can someone provide some guidance as to how to fix this issue.

+2  A: 

Probably you have elevated when opening the services console, but not for your own app.

Add an "Application Manifest File" (that is the name of the template in Visual Studio) and set the requested execution level to "requireAdministrator" (there are comments in the manifest file that will help).

Zooba
Ok.That works.Now to proceed further I tried to attach a debugger to the service using windbg.I get the same access denied error. Should I log in as administrator to attach the debugger?
kjayakum
Yes. Generally you need to be an administrator to debug applications. There is a user right (group policy) that can be assigned to non-administrators, though this may not allow debugging applications running as a different user.
Zooba
thanks. turning off UAC works...
kjayakum
A: 

Hi Zooba, Thanks for your valuable input that helps a lot.

A: 
Please make new questions in a new post
Dofs