多做题,通过考试没问题!

微软认证考试

睦霖题库>其他计算机考试>微软认证考试

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:   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?()

  • A、Move the loop code into the constructor of the service class from the OnStart method.
  • B、Drag a timer component onto the design surface of the service. Move the calls to the long-running procedure from the OnStart method into the Tick event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method.
  • C、Add a class-level System.Timers.Timer variable to the service class code. Move the call to the DoWork method into the Elapsed event procedure of the timer, set the Enabled property of the timer to True, and call the Start method of the timer in the OnStart method.
  • D、Move the loop code from the OnStart method into the DoWork method.
正确答案:C
答案解析:
进入题库查看解析

微信扫一扫手机做题