Καλημέρα,
Θέλω να φτιάξω ένα windows service το οποίο θα κάνει κάποιον έλεγχο σε μία βάση δεδομένων κάθε λεπτό, χρησιμοποιώ timer για αυτό, και θα κάνει update σε κάποιες εγγραφές. Χρησιμοποιώ τον παρακάτω κώδικα, κάτι απλο για αρχή, αλλα απο ότι φαίνετε δεν εκτελεί τον κώδικα που βρίσκετε στο tick event του timer.
χρησιμοποιώ VS 2005 και VB.net.
Dim myLog As EventLog = New EventLog()
Protected Overrides Sub OnStart(ByVal args() As String)
myLog.Source = "WinService"
myLog.WriteEntry("Service started" & Now.ToShortTimeString)
Timer.Enabled = True
NotifyWindowsService.Visible = True
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
Timer.Enabled = False
myLog.Source = "WinService"
myLog.WriteEntry("Service stopped" & Now.ToShortTimeString)
NotifyWindowsService.Visible = False
End Sub
Private Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer.Tick
myLog.Source = "WinService"
myLog.WriteEntry("Tick" & Now.ToShortTimeString)
NotifyWindowsService.Visible = False
End Sub
Ευχαριστώ εκ των προτέρων.