服务程序的OnStart丢出异常,或者它没有启动可以保持服务运行的工作线程。 

解决方案 »

  1.   

      class Program
        {        static string[] _Printers;//所有打印机
         private static System.Timers.Timer m_Timer;  //监视进程  
            //-i /i 安装服务
            //-u /u 卸载服务
            static void Main(string[] args)
            {
                //if (args.Length > 0)
                //{
                //    if (args[0].Contains("i"))
                //    {
                //        Execute("sc create MPS2_LoginDaemon binPath= LoginDaemon.exe start= auto", 10);
                //        return;
                //    }
                //    if (args[0].Contains("u"))
                //    {
                //        Execute("sc delete MPS2_LoginDaemon ", 10);
                //        return;
                //    }
                //}
             
                while (true)
                {
                    Thread.Sleep(1000);            }                }我已经简化成这样了。。
      

  2.   

    你是不是服务陷入死锁了,看你那简化程序就完全没有退出的出口啊,while(true),这个条件一直为真。