[ Juan Carlos @ 31.05.2006. 00:00 ] @
| Pravim windows service koji nadgleda neki folder pomocu FileSystemWatcher, e u cemu je problem dogadjaj Created se nikad ne okida, isti kod sam isprobao u windows aplikaciji i sve radi normalno, medjutim u win. servisu dogadjaj se nikad ne okida evo deo koda.
Friend WithEvents FswArchivos As System.IO.FileSystemWatcher
.
.
.
Me.FswArchivos.EnableRaisingEvents = True
Me.FswArchivos.Path = CType(configurationAppSettings.GetValue("Path", GetType(System.String)), String)
.
.
.
Private Sub FswArchivos_Created(ByVal sender As System.Object, ByVal e As System.IO.FileSystemEventArgs) Handles FswArchivos.Created
neki kod
End Sub
|
[ sivan347 @ 31.05.2006. 10:07 ] @
Nisi instacirao objekat
FswArchivos = New System.IO.FileSystemWatcher
i ako putanju citas iz config fajla probaj ovako
Dim path As String = System.Configuration.ConfigurationSettings.AppSettings.Item("path")
FswArchivos.Path = path
[ mmix @ 31.05.2006. 11:54 ] @
Ima jos jedan aspekt. Koji path ti se nalazi u config file-u?
Ako je UNC path i ako je share na Windows 2000 serveru, nece raditi. UNC watcher radi samo ako je server 2003.
[ Juan Carlos @ 31.05.2006. 17:22 ] @
Nije UNC path, a inace treba da radi na windows serveru 2000.
Izvinjavam se zaboravio sam da iskopiram iz
Private Sub InitializeComponent()
Me.FswArchivos = New System.IO.FileSystemWatcher
.
.
.
End Sub
Znaci objekat je instanciran u InitializeComponent, medjutim ne reaguje na dogadjaj.
[ sivan347 @ 07.06.2006. 12:01 ] @
Da li si ovaj koda stavio u Start event servisa?
Me.FswArchivos.EnableRaisingEvents = True
Me.FswArchivos.Path = CType(configurationAppSettings.GetValue("Path", GetType(System.String)), String)
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.