Currently I am using an ASP.NET Core Web API as a Windows service like this:
var builder = WebApplication.CreateBuilder();
builder.Host.UseWindowsService();
var app = builder.Build();
app.MapGet("/hello", () => "Hello World");
With older .NET Framework Windows services, I have the possibility to overwrite the OnPause
and OnContinue
functionality.
Now I need something similar for my API Windows service.
I need to be able to pause and continue the service and execute logic within these events.
I could not find anything regarding these requirements.
Does anyone have an idea if that is possible and how to realize that?