Click here to Skip to main content
16,005,181 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWindows Service - The service "started and then stopped" ?! Pin
007jb27-May-08 3:03
007jb27-May-08 3:03 
Hello,

I created a little Windows service with VB.NET 2008 (framework 3.5) that displays a message (I know, that's not very clean, but it's for debugging only...) each time a entry is added in a particular table of a database. The installation of the service succeeded, but when I try to start the service, I get the following message :
---------------------------
Services
---------------------------
The AlertSMS service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.
---------------------------
OK
---------------------------

Here's the code :
Public Class AlertSMS

    Protected Overrides Sub OnStart(ByVal args() As String)
        Dim time As System.Threading.Timer
        Dim callBack As New TimerCallback(AddressOf Timer_Tick)
        time = New System.Threading.Timer(callBack, Nothing, 0, 50)
        MsgBox("Le service surveille maintenant la table Alert...", MsgBoxStyle.Information, "Service démarré")
    End Sub

    Public Sub Timer_Tick(ByVal state As Object)
        'Parcours de la liste des entrées de la table Alert
        Dim allalerts As New DAL.AlertCollection
        allalerts.Load()
        For Each elem As DAL.Alert In allalerts.GetCollection()
            MsgBox("Nouvelle alerte : " + vbCrLf + "Message #" + elem.MsgID, MsgBoxStyle.Exclamation, "Attention")
            '*** Traitement de l'alerte ***
            elem.Delete()
            elem.Save()
        Next
    End Sub

End Class


Thanks in advance Wink | ;)

Etienne
AnswerRe: Windows Service - The service "started and then stopped" ?! Pin
Christian Graus27-May-08 3:16
protectorChristian Graus27-May-08 3:16 
GeneralRe: Windows Service - The service "started and then stopped" ?! Pin
007jb27-May-08 3:46
007jb27-May-08 3:46 
GeneralRe: Windows Service - The service "started and then stopped" ?! Pin
Rob Smiley27-May-08 6:27
Rob Smiley27-May-08 6:27 
AnswerRe: Windows Service - The service "started and then stopped" ?! Pin
The Nightcoder27-May-08 15:30
The Nightcoder27-May-08 15:30 
QuestionStart Up Code Pin
Jared774427-May-08 2:35
Jared774427-May-08 2:35 
AnswerRe: Start Up Code Pin
Christian Graus27-May-08 3:13
protectorChristian Graus27-May-08 3:13 
QuestionAppend or Insert the Text in Outlook 2003 message body using vb.net Pin
~Khatri Mitesh~27-May-08 0:28
~Khatri Mitesh~27-May-08 0:28 
QuestionPlease Help In VB 2008 Express Edition Pin
Abidh27-May-08 0:05
Abidh27-May-08 0:05 
AnswerRe: Please Help In VB 2008 Express Edition Pin
Ashfield27-May-08 1:23
Ashfield27-May-08 1:23 
GeneralRe: Please Help In VB 2008 Express Edition Pin
Abidh27-May-08 18:51
Abidh27-May-08 18:51 
GeneralRe: Please Help In VB 2008 Express Edition Pin
Ashfield27-May-08 23:15
Ashfield27-May-08 23:15 
GeneralRe: Please Help In VB 2008 Express Edition Pin
Abidh28-May-08 1:34
Abidh28-May-08 1:34 
GeneralRe: Please Help In VB 2008 Express Edition Pin
Ashfield28-May-08 5:03
Ashfield28-May-08 5:03 
QuestionError in Array Handling Pin
nagendrathecoder26-May-08 23:49
nagendrathecoder26-May-08 23:49 
AnswerRe: Error in Array Handling Pin
dan!sh 27-May-08 1:00
professional dan!sh 27-May-08 1:00 
AnswerRe: Error in Array Handling Pin
Chinners27-May-08 1:00
Chinners27-May-08 1:00 
AnswerRe: Error in Array Handling Pin
nagendrathecoder27-May-08 1:25
nagendrathecoder27-May-08 1:25 
QuestionProcess Time Pin
~V~26-May-08 20:36
~V~26-May-08 20:36 
AnswerRe: Process Time Pin
Ashfield26-May-08 21:14
Ashfield26-May-08 21:14 
GeneralRe: Process Time Pin
~V~26-May-08 21:35
~V~26-May-08 21:35 
GeneralRe: Process Time Pin
Mycroft Holmes26-May-08 22:24
professionalMycroft Holmes26-May-08 22:24 
GeneralRe: Process Time Pin
~V~26-May-08 22:54
~V~26-May-08 22:54 
GeneralRe: Process Time Pin
Mycroft Holmes26-May-08 23:16
professionalMycroft Holmes26-May-08 23:16 
GeneralRe: Process Time Pin
~V~26-May-08 23:30
~V~26-May-08 23:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.