Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Windows Service Application Restart

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MikeZ - 17 Jan 2008 16:19 GMT
How Can Windows Service Application Reatarts itself? Thanks.
Hans Kesting - 17 Jan 2008 16:27 GMT
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
MikeZ - 17 Jan 2008 16:36 GMT
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.

> MikeZ explained :
> > How Can Windows Service Application Reatarts itself? Thanks.
[quoted text clipped - 5 lines]
>
> Hans Kesting
Ignacio Machin ( .NET/ C# MVP ) - 17 Jan 2008 16:58 GMT
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.

Signature

Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

>I mean that write code in windows service application to restart itself. It
> does not include to restart service from second application or command
[quoted text clipped - 9 lines]
>>
>> Hans Kesting
MikeZ - 17 Jan 2008 17:29 GMT
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.

> Hi,
>
[quoted text clipped - 20 lines]
> >>
> >> Hans Kesting
Willy Denoyette [MVP] - 17 Jan 2008 17:47 GMT
> 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.
MikeZ - 18 Jan 2008 17:18 GMT
Willy, I run Windows XP

> > For windows Application, it can restart itself by calling
> > ExitWindowsEx(EWX_REBOOT,0) (From User32.dll)
[quoted text clipped - 5 lines]
>
> Willy.
christery@gmail.com - 20 Jan 2008 02:09 GMT
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
Rudi - 22 Mar 2008 20:12 GMT
> MikeZ explained :
>> How Can Windows Service Application Reatarts itself? Thanks
[quoted text clipped - 3 lines]
> "Recovery" tab
> Hans Kesting

Is it possible to do this setting during install via batch (service
/install ?) and how? Thank you!

regards, Rudi

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.