当前位置: 代码迷 >> ASP.NET >> C# windows services 使用IDictionary 有关问题?
  详细解决方案

C# windows services 使用IDictionary 有关问题?

热度:10136   发布时间:2013-02-25 00:00:00.0
C# windows services 使用IDictionary 问题??
   在安装服务的时候我想用代码操作??在网上找了段代码、如下:

  /// <summary>
        /// 安装服务
        /// </summary>
      /// <param name="stateSaver">集合</param>
        /// <param name="filepath">Windows服务文件</param>
        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 Exception(ex.Message, ex);
          }
   }

这里的程序集IDictionary 是指那些呢???该怎么用 麻烦给个例子啦!  还有那个path是指生成的.exe文件 还是什么、??
  望  结合代码  帮忙解释下??  谢谢…… 
------最佳解决方案--------------------------------------------------------
参数就是键值对应表,你可以将他们输出,然后看看。

MSDN这样解释:它用于保存执行提交、回滚或卸载操作所需的信息。 


------其他解决方案--------------------------------------------------------



------其他解决方案--------------------------------------------------------
都发几天了 也来个人撒 光顾下也行啊
------其他解决方案--------------------------------------------------------
求解。。。
------其他解决方案--------------------------------------------------------
去年到现在还没回啊 诶……

  求解……
------其他解决方案--------------------------------------------------------
又翻尸了...
要安装的文件集合把?
------其他解决方案--------------------------------------------------------
网上的例子,你忽略了一条语句:IDictionary stateSaver = new Hashtable(); 
加上这个就可以了。

------其他解决方案--------------------------------------------------------
path是指包括执行文件在内的完整路径名。
  相关解决方案