By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 1,996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

Service restart itself?

P: n/a
Is there an 'easy' way to have a service stop and restart itself? I
currently have a seperate service running who's job is to watch the other
service and restart it if there is a problem... can I eliminate that one and
have the service restart itself?

Thanks,

Matt
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Matt,
You can use ServiceController class to stop and start windows services.
Something like this

Imports System.ServiceProcess

Dim MyController As ServiceController = New ServiceController("ServiceName")

If MyController.CanStop Then
MyController.Stop()
End If

Val

"Matt" wrote:
Is there an 'easy' way to have a service stop and restart itself? I
currently have a seperate service running who's job is to watch the other
service and restart it if there is a problem... can I eliminate that one and
have the service restart itself?

Thanks,

Matt

Nov 21 '05 #2

P: n/a
Hi Matt,

You can configure your to restart itself if an error occurs.
You can do that from the services.msc - your service - Recovery.

Br.

Kristian F. Thomsen

"Matt" <sp*****@dontgimmespam.com> wrote in message
news:ug**************@TK2MSFTNGP15.phx.gbl...
Is there an 'easy' way to have a service stop and restart itself? I
currently have a seperate service running who's job is to watch the other
service and restart it if there is a problem... can I eliminate that one
and have the service restart itself?

Thanks,

Matt

Nov 21 '05 #3

P: n/a
Hi Kristian,

How does this work? Do I need to leave certain exceptions unhandled?

Unfortunately, one problem I am having is that the socket listener just
decides to not listen any longer, and throws no errors. I even have a timer
running and every few seconds it checks the state of the listener and the
state seems fine.

Thanks,

Matt
"Kristian F. Thomsen" <kf*@ktconsult.dk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi Matt,

You can configure your to restart itself if an error occurs.
You can do that from the services.msc - your service - Recovery.

Br.

Kristian F. Thomsen

"Matt" <sp*****@dontgimmespam.com> wrote in message
news:ug**************@TK2MSFTNGP15.phx.gbl...
Is there an 'easy' way to have a service stop and restart itself? I
currently have a seperate service running who's job is to watch the other
service and restart it if there is a problem... can I eliminate that one
and have the service restart itself?

Thanks,

Matt


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.