473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Service restart itself?

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
3 2263
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: iceman | last post by:
Hello, I have a windows service. I want to restart it after every 24 hour. Is it possible to restart the service programmatically(from the service itself) using the sercvice controller object?...
0
by: felecha | last post by:
Is there a way to write a Service so that it will fail? I'm working on a Service written in VB.Net, that supports an application we are building, and I want to make sure that it can restart...
6
by: Leonardo Curros | last post by:
Hello, I would like to know what's the best way to restart one service. I would like to do it from the service itself. Is this possible? I try it with ServiceController.stop()...
2
by: Tedmond | last post by:
Dear all, I wrote a service by C# but I found the service is not quite stable. I want to add some code that refresh or restart the service itself for a fixed period. Does anyone know how to...
4
by: ThunderMusic | last post by:
Hi, We have many servers setup as a cluster. When one server crashes, another one take the relay... We want to know if it's possible (I suppose it is) to make a Windows service developed with .NET...
7
by: shai | last post by:
I am working at .net 1.1, writing in c#. I have windows service with a COM object. Every unexpected time The COM object throw an error that make my service get stuck (do not respond). I can catch...
6
by: A Marlow | last post by:
Hello, I am new to this game so please bear with me. I have just written a simple application as a service using Visual Studio and managed C++. I wish the process to run in the background and to...
4
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a...
8
by: =?Utf-8?B?TWlrZVo=?= | last post by:
How Can Windows Service Application Reatarts itself? Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.