demonstrates service control : Service : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Service »

 

demonstrates service control









    

/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy

Publisher: Sybex;
ISBN: 0782129110
*/


/*
  Example21_15.cs demonstrates service control
*/

using System;
using System.ServiceProcess;

public class Example21_15 
{

  public static void Main() 
  {

    // connect to the Alerter service
    ServiceController scAlerter = new ServiceController("Alerter");

    Console.WriteLine(scAlerter.DisplayName);
    Console.WriteLine(scAlerter.CanStop);

    scAlerter.Stop();
    Console.WriteLine("Service stopped");
    scAlerter.Start();
    Console.WriteLine("Service started");
  }

}



           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Service