I know how to use background service in asp.net core
public class WatchMan : BackgroundService
{
}
I have a dot core console application which I want to run as window service, can I use BackgroundService or something similar there?
I know how to use background service in asp.net core
public class WatchMan : BackgroundService
{
}
I have a dot core console application which I want to run as window service, can I use BackgroundService or something similar there?
Yes, just be sure to keep the main thread alive so the application does not exit.
This article seems to explain the process decently; https://medium.com/@daniel.sagita/backgroundservice-for-a-long-running-work-3debe8f8d25b
And here's an SO that shows the process aswell:
Trigger background service ExecuteAsync method in .Net core console application
Also if you want to do some background processing, take a look at hangfire:
Which can also be ran from a windows service.