Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows Service stopping immediately
Message
De
01/09/2013 20:26:24
 
 
À
01/09/2013 20:13:24
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01581778
Message ID:
01581811
Vues:
38
>This still works ok from the Services interface. But, when clicking on the EXE, it is still the same thing.

Which same thing? An error message about service not being installed or it starts and then immediately stops? If it's the latter, then you need to have a Console.ReadLine() between the OnStart and OnStop.

I didn't go back and look at your previous code, but in the code you just posted you're using toWindowsService.OnStart() and toWindowsService.OnStop() ... but those methods are protected, not public. So, what have you done there? (I suppose I'll just go back and look at your previously posted code.) That's why MyService has public Start() and Stop() methods, so that I can call them from the static Main (and they in turn call the .OnStart() and .OnStop()).




>>I think you missed some of my code. I have two parts, one when running as a Service, uses ServiceBase.Run():
>
>Thanks, I had simplified too much.
>
>This is what I have now:
>
>
>    Protected Shared Sub Startup(toArgs As String(), toWindowsService As WindowsService)
>
>        ' If this from the Windows Service
>        If Not Environment.UserInteractive Then
>            Run(toWindowsService)
>        Else
>            toWindowsService.OnStart(toArgs)
>            toWindowsService.OnStop()
>        End If
>
>    End Sub
>
>    Protected Overrides Sub OnStart(ByVal toArgs As String())
>        MyBase.OnStart(toArgs)
>
>
>This still works ok from the Services interface. But, when clicking on the EXE, it is still the same thing.
>
>I installed the service with sc. I do not know if this could be a factor.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform