安装服务 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.那个暂停方法该怎么写???请给代码示例
谢谢各位了,
{ 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.那个暂停方法该怎么写???请给代码示例
谢谢各位了,
解决方案 »
- 用vs2005打开一个老版本的网站,出现 未能加载类型web.global
- 关于FCK编辑器加载的问题
- asp.net 文件上传到虚拟目录所在磁盘外??
- 问一个关于GridView中FindControl的问题.
- 请问:如何给ajax无刷新联动DropDownList组(省/市/县)设置初始值?
- 无记录时datagrid表头的显示问题
- C#创建动态对象报错
- session的遍历
- 思归大侠,怎样控制datagrid中控制数据表的主键值?(object_id)
- 谁有vs.net的报表控件crystal report的注册码。
- 文件上传不改名
- 跪求 ASP页面与ASP.NET页面之间的传值,不能在URL里面显示出来。
和api
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
IDictionary mySavedState = new Hashtable();
mySavedState.Add("key","value");
这里的key 和value 分别是一个.exe文件和安装文件名吗??如果 有什么不对的 尽管拍…… 呵呵 ……
暂停服务怎么弄 呢???? 还是不明白^^
{
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