469,927 Members | 1,778 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Service App Using FileSystemWatcher on Windows 2000 Server

Any ideas appreciated. I have written a service application in VB
(VS.Net 2003). On start, the service creates an object that
instantiates a System.IO.FileSystemWatcher like so (the _watcher is
declared at the class level as Private and no WithEvents):

' construct the file watcher
_watcher = New FileSystemWatcher
_watcher.Path = WatchPath
_watcher.NotifyFilter = (NotifyFilters.FileName Or NotifyFilters.Size
Or NotifyFilters.CreationTime)
_watcher.Filter = WatchFilter
AddHandler _watcher.Created, AddressOf OnCreated

' begin watching for file events
_watcher.EnableRaisingEvents = True

OnCreated looks like this:

Private Sub OnCreated(ByVal source As Object, ByVal e As

Dim strFileName As String
Dim procQueue As BaseFileProcessor
Dim ft As FileTaskInfo
Dim bResult As Boolean

' this sub only handles the watcher created notification
If e.ChangeType <> WatcherChangeTypes.Created Then
Exit Sub
End If

' do stuff here

End Sub

This all works really well on my development box. Installutil
installs the service running as Local System, the service starts and
files dropped in the watched directory are processed. However, this
does not work after installing on a Windows 2000 server. The
FileSystemWatcher appears not to be getting *any* notifications. I
have installed and run the service both as Local System and under a
special user account with "Run as service" set. All accounts have
sufficient permissions to access the watched directory, which is on
the same machine but a different logical partition than the service
exe. The path to the watched directory is specified as

A Google search turned up a lot of messages about the apparent
ineffectiveness of FileSystemWatcher in receiving all notifications in
a volume environment, and I am beginning to feel like I should move
toward using a polling approach. This just seemed more elegant and
efficient. Has anyone had any trouble of this kind that you were able
to solve? Have I overlooked something on the operating system
security side that I should look at?

I'd be glad to get any useful tips from experience or URLs for
information that might be useful.


Nov 20 '05 #1
0 1038

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Craig Thompson | last post: by
3 posts views Thread by Vinny | last post: by
4 posts views Thread by Cfleischer | last post: by
2 posts views Thread by Trevor | last post: by
3 posts views Thread by Terry Olsen | last post: by
5 posts views Thread by =?Utf-8?B?Sm9obiBT?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.