Error 1053 using FileSystemWatcher in a service

bdani82

Member
Joined
Jun 7, 2004
Messages
22
Programming Experience
3-5
Hi.

I have Windows Service with this code. fSysWatcher is a FileSystemWatcher

---------------------------------
---------------------------------
Protected Overrides Sub OnStart(ByVal args() As String)
' Inserire qui il codice necessario per avviare il proprio servizio. Il metodo deve effettuare
' le impostazioni necessarie per il funzionamento del servizio.

Try
sPathToWatch = "c:\"
fSysWatcher.Path = sPathToWatch
fSysWatcher.IncludeSubdirectories =
False
fSysWatcher.NotifyFilter = NotifyFilters.Size
fSysWatcher.WaitForChanged(WatcherChangeTypes.Created)
Catch ex As Exception
End Try

End Sub

Private Sub fSysWatcher_Changed(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles fSysWatcher.Changed
End Sub
---------------------------------
---------------------------------

I have installed it on, but I always get a 1053, service will not start in a timely fashion message.

If I comment the last line (fSysWatcher.WaitForChanged(WatcherChangeTypes.Created) the service start correctly

Many thanks for any thoughts or suggestions as to what might be causing this
problem.


 
Back
Top