为什么会出现如下问题,怎样才能执行服务? 请教各位大侠,谢谢!!!!急,万分感谢 !!!!!     无法将文件“obj\Debug\WindowsService2.exe”复制到“bin\Debug\WindowsService2.exe”。文件“bin\Debug\WindowsService2.exe”正由另一进程使用,因此该进程无法访问该文件。

解决方案 »

  1.   

    bin\Debug\WindowsService2.exe 是不是 正在 运行
      

  2.   

    你的服务已经在运行了,要先停止Windows服务,编译器才能覆盖旧文件。
    运行services.msc,找到你的服务,按停止按钮。
      

  3.   

    如何编程启动Windows服务,下面我写的程序好像不能启动服务啊,劳驾各位帮我看看 ,急!!!!万分感谢!!!!
       protected override void OnStart(string[] args)
            {
                // TODO: 在此处添加代码以启动服务。
                double sleeptime = ValidatorDate1(System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss"), System.DateTime.Now.ToString("yyy-MM-dd ") + "07:00:00");
                if (sleeptime < 0) sleeptime += 24*60 * 60 * 1000;
                //writestr("开始", sleeptime);
                System.Timers.Timer t = new System.Timers.Timer(sleeptime);//实例化Timer类,设置间隔时间为10000毫秒; 
                t.Elapsed += new System.Timers.ElapsedEventHandler(rebootsystem);//到达时间的时候执行事件; 
                t.AutoReset = true;//设置是执行一次(false)还是一直执行(true); 
                t.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件; 
                //writestr("结束", sleeptime);        }
      

  4.   

    如果你在Debug模式下的话那就先停止调试,如果仍然不好使 只能打开任务管理器把你的那个进程停止掉就可以了 进程的名字就是定义的名字