About 427,000 results
Open links in new tab
  1. How can I restart a windows service programmatically in .NET

    Sep 21, 2009 · You can set a service to restart after failure. So a restart can be forced by throwing an exception. Use recovery tab on service properties. Be sure to use reset fail count property to prevent service stopping altogether.

  2. Service Application Programming Architecture - .NET Framework

    Sep 15, 2021 · Understand service application programming architecture. Windows Service applications are based on a class that inherits from System.ServiceProcess.ServiceBase.

  3. Start, Stop and Restart Windows Service [C#]

    This example shows how to start, stop and restart a windows service programmatically in C#. The following method tries to start a service specified by a service name. Then it waits until the service is running or a timeout occurs. ServiceController service = …

  4. Using C# to Restart a Windows Service. · GitHub

    Aug 23, 2016 · { eventLog.Source = "RestartServiceConsole"; eventLog.WriteEntry (e.Message, EventLogEntryType.Error, 101, 1); } Console.WriteLine (e.Message); Console.ReadLine (); } } …

  5. Restarting an application within a Windows service - GitHub

    Jun 30, 2022 · I have an .NET 6 service application that runs can run under a service (Windows or systemd), that has a restore backup function which replaces configs, databases and so on from a backup file and then triggers the application to restart within its process.

  6. c# - Restarting Windows from within a .NET application - Stack Overflow

    Apr 10, 2012 · FWIW, this failed for me, but a variation worked: System.Diagnostics.Process.Start ("cmd.exe", $"/c shutdown /r /f /t {afterSeconds}"); Adding the seconds allows your application …

  7. Programmatically Restarting a Windows Service in C# - YouTube

    Apr 21, 2024 · The process involves stopping the service if it's running, then starting it again. Here's how you can achieve this using the System.ServiceProcess namespace and the ServiceController class.

  8. Windows Service in C# - DEV Community

    Aug 22, 2018 · StartLayer0() and StopLayer0() are routines that take care of startup and shutdown and are shared by the service and console application. Our program entry point:

  9. Start, Stop and Restart Windows Service using C#

    Dec 30, 2014 · This article shares C# methods to start, stop and restart a windows service programmatically in C# using .NET build-in class ServiceController.

  10. Shutdown and Restart System Through C# Code - C# Corner

    Suppose your app needs to perform operations such as Shutdown, Restart, Logoff, Lock, Hibernate or Sleep through code. Then you need to call a process that runs a specific executable file (already stored in our system) along with their required arguments.

  11. Some results have been removed
Refresh