Multiple choice technology architecture

Your application is set to start automatically - you stop it using the SCM and restart it. Which sequence of events is triggered from the time the machine is booted?

  1. OnPause, OnStop, OnStart

  2. OnStart, OnStop, OnStart

  3. OnStop, OnContinue

  4. OnStop, OnStart

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

When an automatically-starting service is stopped through SCM and then restarted, the service lifecycle methods invoked are OnStop (when stopping) followed by OnContinue (when resuming/restarting). This reflects that the service was running before and is continuing after the interruption. OnStart would be called for a fresh start from a stopped state, not a restart from a running state.