Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows Service stopping immediately
Message
De
01/09/2013 20:36:00
 
 
À
01/09/2013 20:26: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:
01581812
Vues:
31
>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.

The Console.ReadLine() was necessary. I must have missed that one.

>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()).

As is, presently, when I click on the EXE, I can see that the application runs. It appears on the Task Manager and disappear. So, the Timer doesn't get initiated when I click directly on the EXE. This must be related to the infrastructure you just mentioned.

Presently, the base class is like this:
    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)
            Console.ReadLine()
            toWindowsService.OnStop()
        End If

    End Sub

    Protected Overrides Sub OnStart(ByVal toArgs As String())
        MyBase.OnStart(toArgs)
So, those methods are protected. But, I'll have to switch a few things in here to adopt your approach to see if that will help.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform