现在我开发了一个Windows服务,因为手工替换这个服务太麻烦,想做自动升级的功能,所装服务的机器可以上网.想请教各位大侠,指点迷经,谢谢

解决方案 »

  1.   

    在你项目--属性---生成那里 使用DOS命令来停止服务 NET STOP ??Service名称在生成后那里复制文件 用NET START 来??Service名称..
      

  2.   

    用process试试service检测到有更新时,自动下载更新包
    下载完毕且要执行更新时,启动一个外部进程(updater),然后调用service的stop方法
    updater在启动后,检测service停止完毕后执行更新操作(就是替换service的相关文件)
    updater更新完毕后启动service
    更新结束
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.ServiceProcess; // 先要添加引用 namespace ConsoleApplication16
    {
        class Program
        {
            static void Main(string[] args)
            {
                ServiceController SC = new ServiceController("服务名");
                SC.Stop();
                SC.WaitForStatus(ServiceControllerStatus.Stopped);
                // 开始更新,替换dll
                SC.Start();
            }
        }
    }
      

  4.   

    http://topic.csdn.net/u/20090422/08/69f9713b-3982-4313-ab11-7fb6eefdcf93.html这是前几天刚发的帖子~看下~