ServiceController AccessDenied exception

From: Strider (anonymous_at_discussions.microsoft.com)
Date: 11/03/03


Date: Mon, 3 Nov 2003 06:39:13 -0800

Got it!

The command ID parameter should be an integer value
between 128 and 256. Values less than 128 are reserved
by the operating system.

Funny how the .NET Framework class library documentation
doesn't mention this!

>-----Original Message-----
>Hello.
>
>I have created a Windows Service and now I'm trying to
>develop a controller application for my service.
>
>So, I created a Windows.Forms project, I added a
>System.ServiceProcess.ServiceController component on my
>form and I hooked it up to my service.
>
>The start and stop commands work just fine, but when I
>try to invoke a custom command on my service using the
>ServiceController.ExecuteCommand method, I get the
>following exception:
>
>"System.InvalidOperationException: Cannot control
>MyService service on computer '.'. --->
>System.ComponentModel.Win32Exception: Access is
denied\r\n
>
>I guess it has something to do with the services
security
>settings or my code's access permissions.
>
>Any clues?
>
>Thanks in advance.
>.
>