c# - How do I write a windows service that polls a directory for new files? -


I have created a window service, it is basically reading a temporary file on my machine, in a database Reading and then removing it I have written in the onStart method for these tasks, so I need to start the service again when I need it, but what I need is that the service is automatically The creation should be understood in the file in my folder and then work on it.

So where should I put this special code in my windows service?

Since FileSystemWatcher does not guarantee you to notify all file system changes, I recommend to vote with This approach is also easy on system resources.

Internally, the FSW buffers event that is received from the file system. If many incidents occur at the same time then this buffer will overflow and you will start losing the event. Unless your event handler code ends very quickly or you use some queue mechanism, you will still start to lose events. IMO, it makes FSW less than 100% reliable perspective.

More details are given here.

A note on the system resource: FSW is dependent upon entering a callback with OS file. I do not have any matrix of how many accounts I have in system resources. In order to actively use the timer to vote on the system, my suggestions do not require any resources from the file system.

Unless you really need pass-real-time behavior ...


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -