I have InvalidOperationException for an unknown reason to me. The code worked fine in an ad hoc network, but when you upgrade to Active Directory, I got this problem.
I have sufficient access rights. Windows tool "Services" give me the opportunity to change the status of services. However, I am InvalidOperationException when you try to do this with ServiseController.
a simple example:
ServiceController sc = new ServiceController(@"SomeService", @"SomeMachine");
Here I get an instance of service with all members values.
if (sc.Status == ServiceControllerStatus.Runing)
update and read state as well.
But (and any other attempt to change the state) are getting an InvalidOperationException.
Can you please tell what are the possible reasons for this execution of the code wiht fine working Services tool.
Thank you very much.