示例#1
0
 /// <summary>
 /// Program entry point
 /// </summary>
 /// <param name="args">
 /// Program arguments
 /// </param>
 static void Main(String[] args)
 {
     if (!Environment.UserInteractive)
     ServiceBase.Run(new WindowsService());
      else
      {
     using (ServiceHost host = new ServiceHost())
     {
        if (host.Startup())
        {
           Console.Write("Press enter to shut down.");
           Console.ReadLine();
        }
     }
      }
 }