c# creating a small program that will listen to directories and create files as a SERVICE
process:
- i need to make a program that will always be running in the background
- it will look at 5 different direct开发者_运维问答ories
- as soon as there are new files in those directories, it will create similar versions of those files in a new directory
questions:
- when i go to new-->project. should i select SERVICE? ive never done this before
- how do i ensure that this program is always running even if the operator restarted the computer? - maybe i should be running it from a server or something?
As for the Directory watching you can use FileSystemWatcher. read the documentation on MSDN.
And Yes you should make it as a Windows Service
For starting Set the StartType Mode to Automatic in Service installer
- Yes, you should create a windows service for this. A windows can be set to start automatically when the machine is restarted.
- If you are looking for file changes look into the FileSytemWatcher class
Yes. You'll want to build this as a Windows Service. This will cause it to (if you configure it this way) startup immediately on system startup, and always be running in the background.
Look at FileSystemWatcher for monitoring the directories.
I recommend creating a Windows Service (you don't need to run it on a server, it will work on any computer) and look for files using the FileSystemWatcher class
Yes use the windows service project, when you register it as a windows service you can set the startup type to auto, in this way it will run anytime the computer be restarted.
You will need to use the FileSystemWatcher class to what over those folders, I suppose you know the rest, let me know if you need further details.
精彩评论