We have built a window service that listens to folders with FileSystemWatcher
, when created we process the file and so on. But after couple of days the event stops working.
What i think the problem is, that FSW has an internal buffer, when it overflows its an error, take a look in this article that offer code to solve this problem.
Hope this help anyone.
A couple of things to try, as suggested here:
In summary:
protected virtual void TimerTick(object sender, EventArgs e)
{
// stop your timer
this.timer.Stop();
try
{
// TODO: add event handler specifics
}
catch
{
// TODO: add some logging to help you see what's going on
}
// restart your timer
this.timer.Start();
}