安装服务        public static void InstallService(IDictionary stateSaver, string filepath)
      {          try
          {
              AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller();
              myAssemblyInstaller.UseNewContext = true;
              myAssemblyInstaller.Path = filepath;
              myAssemblyInstaller.Install(stateSaver);
              myAssemblyInstaller.Commit(stateSaver);
              myAssemblyInstaller.Dispose();
          }
          catch (Exception ex)
          {              throw new SysException(ex.Message, ex);
          }
   }
问题

1.上面的安装方法中传递那两个参数IDictionary stateSaver, string filepath分别指的是什么,请举个例子.
2.那个暂停方法该怎么写???请给代码示例
     谢谢各位了,  

解决方案 »

  1.   

    C#启用服务 关闭服务 安装服务 卸载服务我博客里面有!   有运用ProcessStartInfo
    和api
      

  2.   

    stateSaver:程序集
    filepath:Windows服务文件  
     参考: http://msdn.microsoft.com/zh-cn/library/system.configuration.install.assemblyinstaller(VS.80).aspx
    http://www.cnblogs.com/johnwu/archive/2010/03/25/1694524.html
      

  3.   

    还有那个IDictionary stateSaver  程序集 , 代表那些,比如我这样
     IDictionary mySavedState = new Hashtable();
       mySavedState.Add("key","value");
    这里的key 和value 分别是一个.exe文件和安装文件名吗??如果 有什么不对的 尽管拍……   呵呵 ……
    暂停服务怎么弄 呢???? 还是不明白^^
      

  4.   

    public static void UnInstallService(string filepath)
            {
                try
                {
                    AssemblyInstaller myAssemblyInstaller = new AssemblyInstaller();
                    myAssemblyInstaller.UseNewContext = true;
                    myAssemblyInstaller.Path = filepath;
                    myAssemblyInstaller.Uninstall(null);
                    myAssemblyInstaller.Dispose();
                }
                catch (Exception ex)
                {
                    throw new SysException(ex.Message, ex);
                }
            }服务操作ServiceController[] services = ServiceController.GetServices();
    没有暂停方法
    http://msdn.microsoft.com/zh-cn/library/system.configuration.install.assemblyinstaller_members(v=VS.80).aspx
      

  5.   

    那个程序集IDictionary stateSaver  包含些什么 能解释下不、?????
      

  6.   

    那个程序集IDictionary stateSaver 包含些什么 能解释下不、?????