读书人

C# windows services 使用IDictionary

发布时间: 2012-12-17 09:31:40 作者: rapoo

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是指包括执行文件在内的完整路径名。

读书人网 >asp.net

热点推荐