Windows Service never call OnStop() method when shutdown

后端 未结 2 1499
暖寄归人
暖寄归人 2021-01-21 08:22

I have simplest possible windows service.

I need service to run under Local System account.

If I start/stop service from SCM, everything works f

2条回答
  •  独厮守ぢ
    2021-01-21 08:45

    Microsoft Windows has added an option called Fast Startup which does not actually shutdown the computer.

    As noted in the Fast Startup setting description, Restart isn't affected. This is why the Restart triggers OnShutdown and Shutdown does not.

    Turning off Fast Startup will trigger OnShutdown for both Restart and Shutdown.

提交回复
热议问题