ServiceController throws exception

S

Strider

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.
 
S

Strider

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!
 

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