I have a BackgroundService
that needs to perform an operation before the OS shuts down. Is there any way to do this with an IHostedService
since there isn't an OnShutdown()
event like in ServiceBase
?
I tried making it work by implementing StopAsync
, but it started to add a lot of complexity to the project since that runs any time the service is stopped.