2015-06-22 57 views

回答

0
#if (!DEBUG) 
     ServiceBase[] ServicesToRun; 
     ServicesToRun = new ServiceBase[] 
     { 
      new BirthdayService() 
     }; 
     ServiceBase.Run(ServicesToRun)`#else 
     // Debug code: this allows the process to run as a non-service. 
     // It will kick off the service start point, but never kill it. 
     // Shut down the debugger to exit 
     BirthdayService service = new BirthdayService(); 
     service.InitializeUsersTable(); 
     service.GetUserAndSendMail(); 
     // Put a breakpoint on the following line to always catch 
     // your service when it has finished its work 
     System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); 
#endif 
相关问题