473,395 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

FileSystemWatcher in Service App on Windows 2000 Server

Previously posted on the VB newsgroup with no replies, so 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
FileSystemEventArgs)

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

' this sub only handles the watcher created notification
messages
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
"e:\directory\subdirectory".

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.

Thanks.

Rich

Jul 21 '05 #1
1 2127
Thanks to anyone who tried to help. Problem turned out to be unrelated to
FileSystemWatcher, rather having to do with an outdated (2.5) version of
MDAC installed on the server (the app was writing notifications to a
database) and insufficient privileges for the system account to access
various folders where it was attempting to move files.

"Rich Miller" <rm*****@noplace.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Previously posted on the VB newsgroup with no replies, so 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
FileSystemEventArgs)

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

' this sub only handles the watcher created notification
messages
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
"e:\directory\subdirectory".

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.

Thanks.

Rich

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: cxw0106 | last post by:
Hello, I have some weird problem with the FileSystemWatcher. I have developed an application that monitors a network directory for file changes of a certain file type. The program runs well for...
1
by: brian | last post by:
Hello all. I've created a FileSystemWatcher (ASP.Net w/VB.Net code behind pages) that is to reside on Server A and monitor the activity of folder on Server B. The application works fine with...
0
by: Lloyd Sheen | last post by:
I have created a FileSystemWatcher application that monitors a set of folder for changes. This works well as a windows app. I have copied the code from the windows app to a windows service and...
3
by: Craig Thompson | last post by:
I've attempted to write a windows service that creates one FileSystemWatcher for each entry in a XML config file. Everything start perfrectly and runs as I expect for about 5 minutes and then...
2
by: Sacha Korell | last post by:
I need to set up a FileSystemWatcher in my web application (to automatically process uploaded files) and I'm trying to decide where to set it up. I would like to keep it within the web app, but it...
20
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
1
by: Megan | last post by:
I have a windows service that monitors a folder. I have a routine to process XML files whenever a new file gets created (in the folder that the Filesystemwatcher is monitoring.) Since the files...
0
by: Rich Miller | last post by:
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...
1
by: Rich Miller | last post by:
Previously posted on the VB newsgroup with no replies, so any ideas appreciated. I have written a service application in VB (VS.Net 2003). On start, the service creates an object that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.