Home All Groups Group Topic Archive Search About

Check if Service is running?

Author
9 May 2006 2:10 PM
Joris De Groote
Hi,

can vb check if a windows service is running or not? ( Webclient )

Thanks
Joris

Author
9 May 2006 2:15 PM
Herfried K. Wagner [MVP]
"Joris De Groote" <joris.degro***@skynet.be> schrieb:
> can vb check if a windows service is running or not? ( Webclient )

On the client or on the server?  I doubt that this is possible on the client
without writing some ugly ActiveX control or .NET Browser Control.  Maybe
it's better to develop a classic rich-client Windows Forms application
instead of a Web application.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
9 May 2006 2:28 PM
Joris De Groote
It's a VB.NET program that runs on a server, so it's not a web application.


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:eC0LLM3cGHA.3840@TK2MSFTNGP04.phx.gbl...
> "Joris De Groote" <joris.degro***@skynet.be> schrieb:
>> can vb check if a windows service is running or not? ( Webclient )
>
> On the client or on the server?  I doubt that this is possible on the
> client without writing some ugly ActiveX control or .NET Browser Control.
> Maybe it's better to develop a classic rich-client Windows Forms
> application instead of a Web application.
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
9 May 2006 2:41 PM
jayeldee
Joris,

If you set a reference to System.ServiceProcess, you could use a
function like this one below to check it.  I use it in a service of
mine to check for dependency services.

    Function CheckIfServiceIsRunning(ByVal serviceName As String) As
Boolean

        Dim mySC As ServiceProcess.ServiceController
        mySC = New ServiceProcess.ServiceController(serviceName)
        If mySC.Status = ServiceProcess.ServiceControllerStatus.Stopped
Then
            ' Service isn't running
            Return False
        ElseIf mySC.Status =
ServiceProcess.ServiceControllerStatus.Running Then
            ' Service already running
            Return True
        End If

    End Function
Author
9 May 2006 2:57 PM
jayeldee
You'd also want to put that in a Try Catch block.  You'll get an
exception if the service name is invalid IIRC.
Author
15 May 2006 8:18 AM
Joris De Groote
Thanks

Show quoteHide quote
"jayeldee" <jayel***@gmail.com> wrote in message
news:1147186678.274759.42120@e56g2000cwe.googlegroups.com...
> You'd also want to put that in a Try Catch block.  You'll get an
> exception if the service name is invalid IIRC.
>
Author
9 May 2006 5:48 PM
vbnetdev
So you are checking the server to verify this particular service is running
right?



--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"Joris De Groote" <joris.degro***@skynet.be> wrote in message
news:eIRBOT3cGHA.5016@TK2MSFTNGP04.phx.gbl...
> It's a VB.NET program that runs on a server, so it's not a web
> application.
>
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
> news:eC0LLM3cGHA.3840@TK2MSFTNGP04.phx.gbl...
>> "Joris De Groote" <joris.degro***@skynet.be> schrieb:
>>> can vb check if a windows service is running or not? ( Webclient )
>>
>> On the client or on the server?  I doubt that this is possible on the
>> client without writing some ugly ActiveX control or .NET Browser Control.
>> Maybe it's better to develop a classic rich-client Windows Forms
>> application instead of a Web application.
>>
>> --
>> M S   Herfried K. Wagner
>> M V P  <URL:http://dotnet.mvps.org/>
>> V B   <URL:http://classicvb.org/petition/>
>
>
Author
15 May 2006 8:19 AM
Joris De Groote
Yep


Show quoteHide quote
"vbnetdev" <vbnetdev@community.nospam> wrote in message
news:eZG4$C5cGHA.4148@TK2MSFTNGP05.phx.gbl...
> So you are checking the server to verify this particular service is
> running right?
>
>
>
> --
> Get a powerful web, database, application, and email hosting with KJM
> Solutions
> http://www.kjmsolutions.com
>
>
>
> "Joris De Groote" <joris.degro***@skynet.be> wrote in message
> news:eIRBOT3cGHA.5016@TK2MSFTNGP04.phx.gbl...
>> It's a VB.NET program that runs on a server, so it's not a web
>> application.
>>
>>
>> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
>> news:eC0LLM3cGHA.3840@TK2MSFTNGP04.phx.gbl...
>>> "Joris De Groote" <joris.degro***@skynet.be> schrieb:
>>>> can vb check if a windows service is running or not? ( Webclient )
>>>
>>> On the client or on the server?  I doubt that this is possible on the
>>> client without writing some ugly ActiveX control or .NET Browser
>>> Control. Maybe it's better to develop a classic rich-client Windows
>>> Forms application instead of a Web application.
>>>
>>> --
>>> M S   Herfried K. Wagner
>>> M V P  <URL:http://dotnet.mvps.org/>
>>> V B   <URL:http://classicvb.org/petition/>
>>
>>
>
>