Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Service - FileSystemWatcher question

Status
Not open for further replies.

traceytr

Programmer
Mar 13, 2001
94
US
Hi. I created a Windows service which uses the FileSystemWatcher and also the server-based Timer control to monitor changes to a specific directory, and I've installed the service on the test server.

The FileSystemWatcher component watches for changes to the directory and reacts when they occur, carrying out associated processing on the Created and Changed events.

The server-based Timer control has been set to raise an event every five minutes to carry out the associated processing. (Same processing as is carried out when the FileSystemWatcher event is raised.)

The FileSystemWatcher control works well when I'm actually LOGGED ON to the test server. I paste test files into the watched directory, and they are processed almost instantly.

However, when I'm NOT LOGGED ON to the server the FileSystemWatcher does not seem to be working. In Windows Explorer, I've mapped a drive to the test server. When I paste test files into the watched directory in my Windows Explorer, the files sit in the directory until the Timer control raises the event. Then the files are processed.

Does anyone know what might be going on here? Could this be due to network traffic? Thanks in advance for any advice and discussion of this issue.

Tracey
 
In your change event of your FSW, what other events are you watching for? Created, and changed , or just created? I had a similar issue and I just monitor for newly created files and have not seen this issue again.
 
Interesting... I'm watching for the Created and the Changed events. I'll try watching only for the Created event, and I'll let you know what happens. Thanks.
 
I made the change so the FSW watches only for the Created event. There seems to be no change. When I test while logged on to the server, the files are processed instantly. The FSW grabs the files almost faster than I can see it. But when I'm not logged into the server, and I'm pasting files into the watched directory in my Windows Explorer, the files sit there and are not processed until the timer raises the event. Thank goodness for the timer.

Thanks.

Tracey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top