Pregunta

Is there a feasible way to allow an instance of the FileSystemWatcher class to continue to run, even when the application pool shuts down due to inactivity, say overnight? The .NET default is 20 minutes of inactivity.

Ideally, I'd like for the FileSystemWatcher to always listen for file system changes, as the potential for files being transferred in/out of our file store, or modified, is there even overnight when our application pool is shut down due to inactivity.

Thanks.

EDIT: For more context, my original thought was to implement an instance of FileSystemWatcher within my C# web application that will be deployed and run by IIS. It's functionality will be fairly standard: listening for file creation, file deletion, and file renames.

¿Fue útil?

Solución

IIS is really intended to handle incoming requests, and is not suited towards this type of activity.

If you want the FileSystemWatcher to always work, it would be better to move your code into a standard Windows Service. This will cause it to execute upon the system startup, and continue running, even if IIS is not running or is idle.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top