473,382 Members | 1,717 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,382 software developers and data experts.

Windows Service Application Restart

How Can Windows Service Application Reatarts itself? Thanks.
Jan 17 '08 #1
8 9767
MikeZ explained :
How Can Windows Service Application Reatarts itself? Thanks.
Control Panel Administrative Tools Services
select your service
right-mouse properties
"Recovery" tab

Hans Kesting
Jan 17 '08 #2
I mean that write code in windows service application to restart itself. It
does not include to restart service from second application or command line.

"Hans Kesting" wrote:
MikeZ explained :
How Can Windows Service Application Reatarts itself? Thanks.

Control Panel Administrative Tools Services
select your service
right-mouse properties
"Recovery" tab

Hans Kesting
Jan 17 '08 #3
Hi,

Do you realize the contradiction in your statement?
You want to write a code that stops itself and then restart again :)

Having said that, you can use an external process to do it. if your win
service spawn a process then this process can stop the service, do what you
need and restart the service.

You use ServiceControlManager for that.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"MikeZ" <Mi***@discussions.microsoft.comwrote in message
news:71**********************************@microsof t.com...
>I mean that write code in windows service application to restart itself. It
does not include to restart service from second application or command
line.

"Hans Kesting" wrote:
>MikeZ explained :
How Can Windows Service Application Reatarts itself? Thanks.

Control Panel Administrative Tools Services
select your service
right-mouse properties
"Recovery" tab

Hans Kesting

Jan 17 '08 #4
For windows Application, it can restart itself by calling
ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)

As you said, if the service cannot do the job by itself, an extra process is
the best choice.

Thanks.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Do you realize the contradiction in your statement?
You want to write a code that stops itself and then restart again :)

Having said that, you can use an external process to do it. if your win
service spawn a process then this process can stop the service, do what you
need and restart the service.

You use ServiceControlManager for that.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"MikeZ" <Mi***@discussions.microsoft.comwrote in message
news:71**********************************@microsof t.com...
I mean that write code in windows service application to restart itself. It
does not include to restart service from second application or command
line.

"Hans Kesting" wrote:
MikeZ explained :
How Can Windows Service Application Reatarts itself? Thanks.

Control Panel Administrative Tools Services
select your service
right-mouse properties
"Recovery" tab

Hans Kesting


Jan 17 '08 #5
"MikeZ" <Mi***@discussions.microsoft.comwrote in message
news:1E**********************************@microsof t.com...
For windows Application, it can restart itself by calling
ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)
This does not restart an application, it restarts the system, you want to
restart the service, quite different isn't?
Restarting a Service is a feature that is OS version dependent, so what OS
are you running?

Willy.

Jan 17 '08 #6
Willy, I run Windows XP

"Willy Denoyette [MVP]" wrote:
"MikeZ" <Mi***@discussions.microsoft.comwrote in message
news:1E**********************************@microsof t.com...
For windows Application, it can restart itself by calling
ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)

This does not restart an application, it restarts the system, you want to
restart the service, quite different isn't?
Restarting a Service is a feature that is OS version dependent, so what OS
are you running?

Willy.

Jan 18 '08 #7
Try with nr 2 answer, put it in autorestart and just die... (the
service, not u) it will restart, but fixing problems that way is not
recommended..
//CY
Jan 20 '08 #8
Hans Kesting wrote:
MikeZ explained :
>How Can Windows Service Application Reatarts itself? Thanks
Control Panel Administrative Tools Services
select your service
right-mouse properties
"Recovery" tab
Hans Kesting
Is it possible to do this setting during install via batch (service
/install ?) and how? Thank you!

regards, Rudi
Mar 22 '08 #9

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

Similar topics

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: ...
1
by: sidd | last post by:
Hi all, how do i exit out(unload) of a windows service in case of an error. so i have a code block as follows try { } catch(exception ex) { //log to event log
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.
7
by: Ahmed Perlom | last post by:
Hi all, I am trying to start a windows application that has a GUI from a Windows service written in .NET 2.0. I have been searching on this for few days now with no avail. When using the...
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...
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...
0
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi All I would like to install the same Windows Service project on the same server under different names, one for each customer. I have been able to do it but I would like an expert opinion as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.