473,397 Members | 2,068 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,397 software developers and data experts.

windows service restart

Can you please help me to resolve the following issue:
I developed a windows service. At start up (I have overriden OnStart
method) it connects to a web service and if the connection fails the windows
service sets ExitCode property to non-zero value (55) and calls Stop method.
If this happens when user starts the service in Services snap-in SCM shows
error massage and service stops - it's OK.
I configured automatic startup and Recovery settings for the service:
- set 'restart the service' for the first, second and subsequent failures,
- 'reset fail count after' 0 days,
- 'restart service after' 1 minute
but SCM does not attempt to restart the service at startup if error happens.
May 25 '06 #1
1 3641
Assuming you've got the settings configured ok, when you get the error is
the service process exe still running? I'm wondering if the executable is
still running even though the service part has failed somehow.

I suspect all this may have something to do with your OnStart. Connecting to
a web service is a time-consuming thing. OnStart IMO is for short lived
stuff. Windows has a timeout here. It's also not clear to me that you can
call ServiceController.Stop from in your OnStart either because the service
might not be marked as started until you return from OnStart. Plus if a
thread took an exception here you might be stuck with the process running
but the service pieces inactive.

I'd dump all that stuff from OnStart and defer it to a Thread running from
your ServiceMain, something like that.

--
Phil Wilson [MVP Windows Installer]
----
"Sergey Krutous" <Se***********@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
Can you please help me to resolve the following issue:
I developed a windows service. At start up (I have overriden OnStart
method) it connects to a web service and if the connection fails the
windows
service sets ExitCode property to non-zero value (55) and calls Stop
method.
If this happens when user starts the service in Services snap-in SCM shows
error massage and service stops - it's OK.
I configured automatic startup and Recovery settings for the service:
- set 'restart the service' for the first, second and subsequent failures,
- 'reset fail count after' 0 days,
- 'restart service after' 1 minute
but SCM does not attempt to restart the service at startup if error
happens.

May 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Francis Lavoie | last post by:
Is it possible to restart windows services? (remotely and locally) Because I have a little script that retreive the LastWaitTimeout key of the automatic update, delete that key if it out schedule...
4
by: Keith | last post by:
I'm in the same boat as the fellow who posted this message back in August: Title : Windows Service, How does one make a service "fail" properly? Author : Ross Bennett Group :...
7
by: Mike | last post by:
I want to create a windows service that will monitor another window service. what i need for the service to do is, if a service is stopped I need it to start the service back up example: ...
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()...
17
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
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: sergio.calleja | last post by:
Hi Everybody, i need to restart a windows service made with c# when an fixed event is raised. So to test it, I've added a servicecontroller to my service, and in the creation method, i've created...
8
by: =?Utf-8?B?TWlrZVo=?= | last post by:
How Can Windows Service Application Reatarts itself? Thanks.
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.