I run a web API as windows service with Microsoft.Extensions.Hosting.WindowsService.
This allows me to run it as service or as console app (if I just click the exe). Actually pretty sweet.
But is there a way to detect how it is running (console app or windows service) at runtime? Would be interersting to have this in the logs ...