PrepAway - Latest Free Exam Questions & Answers

Tag: site:aiotestking com global group group1 vpn access

What should you do?

You develop a service application named PollingService that periodically calls long-running procedures. These procedures are called from the DoWork method. You use the following service application code:
partial class PollingService : ServiceBase
{
bool blnExit = false;
public PollingService() {}
protected override void OnStart(string[] args)
{
do
{
DoWork();
} while (!blnExit);
}
protected override void OnStop()
{
blnExit = true;
}
private void DoWork() { …}
}
When you attempt to start the service, you receive the following error message: Could not start the PollingService service on the local computer. Error 1053: The service did not respond to the start or control request in a timely fashion. You need to modify the service application code so that the service starts properly. What should you do?