Hi all,
I am trying to controll a service programatically using the ServiceControll er class .net c#.
It is giving me an error that it cannot find the service name.
I have tried it stopping with the command line using NET, and it works but not with my code!
Can anyone please point me where I might be wrong?
My code:
string SERVICENAME = "TestServic e";
string SERVERNAME = "ABC" ;
ServiceControll er myController = new ServiceControll er();
myController.Ma chineName = SERVERNAME;
myController.Se rviceName = SERVICENAME;
myController.St op();
myController.St art();
my commandline goes something like this:
C:\test>NET STOP "TestServic e"
and it works.
I have tried without the machine name, and also with my IP address both failed!
The exact error is something like:
"Cannot open TestService service on computer 'ABC'." "
Thanks in advance!
I am trying to controll a service programatically using the ServiceControll er class .net c#.
It is giving me an error that it cannot find the service name.
I have tried it stopping with the command line using NET, and it works but not with my code!
Can anyone please point me where I might be wrong?
My code:
string SERVICENAME = "TestServic e";
string SERVERNAME = "ABC" ;
ServiceControll er myController = new ServiceControll er();
myController.Ma chineName = SERVERNAME;
myController.Se rviceName = SERVICENAME;
myController.St op();
myController.St art();
my commandline goes something like this:
C:\test>NET STOP "TestServic e"
and it works.
I have tried without the machine name, and also with my IP address both failed!
The exact error is something like:
"Cannot open TestService service on computer 'ABC'." "
Thanks in advance!
Comment