You work as the application developer at Domain.com.
You create a new service application named Certkiller App29.
You install Certkiller App29 on five application servers running in the Domain.com network.
You then apply the code segment shown below. Note that line numbers are only included for reference pruposes.
01 public void StartService(string serverName){
02 ServiceController crtl = new
03 ServiceController(” Certkiller App29″);
04 if (crtl.Status == ServiceControllerStatus.Stopped){
05 }
06 }
You want Certkiller App29 to start if it stops.
You must create the routine which will start Certkiller App29 on the server defined by the serverName input parameter.
Choose the two lines of code which you should include in your code segment.
Each correct answer presents only part of the complete solution. Choose two answers.
A.
Add this line of code between line 03 and line 04: crtl.ServiceName = serverName;
B.
Add this line of code between line 03 and line 04: crtl.MachineName = serverName;
C.
Add this line of code between line 03 and line 04:crtl.Site.Name = serverName;
D.
Add this line of code between line 04 and line 05:crtl.Continue();
E.
Add this line of code between line 04 and line 05:crtl.Start();
F.
Add this line of code between line 04 and line 05:crtl.ExecuteCommand(0);
Explanation:
The ServiceController is capable of controller services on other computers, the MachineName should be specified. The service should be started with the Start() method if it is in the stopped state. Setting the ServiceName to the machine name is incorrect.
No such property as SiteName
Continue cannot re-start a stopped service only a paused one. ExecuteCommand is used to fire a custom command on the service.
I agree with the answer.