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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileSystemWatcher Service Problem

Status
Not open for further replies.

fawkes

Technical User
Sep 12, 2003
343
0
0
GB
I've set up a windows service using a file system watcher and can't get it to run.

It hangs up on the following:

Code:
'Set the file properties the file system watcher uses to detect 
        'changes to files
        Try
            Me.EventLog.WriteEntry("Set wait for changed")
            Me.FileSystemWatcher1.WaitForChanged(IO.WatcherChangeTypes.Created)
        Catch ex As Exception

            'Write the error to the event log
            Me.EventLog.WriteEntry( _
                "Could not set the wait for changed. Error was: " & _
                ex.Message, System.Diagnostics.EventLogEntryType.Error, 1, _
                CType(1, Short))

        End Try

It writes the first log entry but nothing afterwards so I know it isn't getting past the WaitForChanged property setting.

I'm not getting any errors in the event log.

Does anyone have any ideas?
 
What account is your service running under?
It may not have access to the filesystem, if it's running as NetworkService.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
I've tried it in three of the four options, I haven't tried Network.

I've removed the WaitForChanged text and it works fine now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top