views:

881

answers:

3

I get the following error in Vista while trying to start/stop a Windows Service that I created.

Cannot open ServiceName service on computer '.'.

The same code works for XP. What should I do to solve this problem?

A: 

Without the code that you are using, it's impossible to tell. Post the code that you are using.

casperOne
+1  A: 

User Account Control (aka UAC). UAC means that the user is not running as an administrator. Your application needs to tell windows that it requires admin rights. I think this page explains it better than I can.

pipTheGeek
A: 

Just stumbled upon your question today, though you had asked it a while back :)
I was having a similar problem on Windows Vista while i was trying to start a .net based service that i had developed.
I opened the Properties dialog of the service and changed the Log On user to Local System (Previously i was trying to start the service using Network Service). On restarting the service i didn't get any error.
In case you are still wondering about the answer, this has worked for me. I hope it will work for you too.
Cheers!

Burhan