I have an ASP.NET Core 8.0 C# web application that includes DI container services that are meant to work alongside the main interaction pipeline. Two of them are FileSystemWatcher
s. One written for relaying images to Tinystash, another for parsing the XML agent upload data and shoving it to the database. These services do not tend to work, due to the fact that IIS kills off the WebHost
as soon as no HTTP requests come into the site. The logs (Serilog.Sinks.EventLog
) have a following entry: Application is shutting down...
, which infers that the site process has been killed. Therefore, the FileSystemWatcher
does not have enough time to instantiate and register an event handler. I need to make the web app always online and prevent it from self-disabling. The web app project does not include a Kestrel launch configuration, due to it being directly upgraded from .NET Core 3.1.
My IIS idleTimeout
setting is set to 0, meaning the site should never shutdown, however it is not the case with my problem. I had an idea to implement a separate controller with one endpoint, used to receive PING
and reply PONG
. However, this is not an efficient solution, because A. it is a bit too overkill (not KISS-compliant), and B. it will only wake the system to process one request, without waiting to receive the second.