到命令行下,执行InstallUtil命令
用法:InstallUtil [/u | /uninstall] [option [...]] assembly [[option [...]] assembly] [...]]InstallUtil 执行每个给定程序集中的安装程序。
如果指定 /u 或 /uninstall 开关,则它卸载
程序集;反之,则安装它们。与其他
选项不同,/u 应用于所有的程序集,而不管它出现在命令行上
的位置。安装程序以事务处理的方式完成:如果其中的一个
程序集安装失败,则其他的所有安装程序集的安装
都会被回滚。卸载不是按事务处理的。选项的格式为 /switch=[value]。出现在程序集名称之前的
任何选项都将应用到该程序集的安装。
选项是累积的但可以重写——为一个程序集指定的选项
将应用到下一个程序集,
除非为该选项指定一个新值。所有选项的默认设置是空的或为假,
除非另行指定。识别的选项:用于安装任何程序集的选项:
/AssemblyName
 程序集参数将被解释为程序集名称。
 默认为将程序集参数解释为文件名。/LogFile=[filename]
  向其中写入进度的文件。如果为空,则不写入日志。默认为
 <assemblyname>.InstallLog/LogToConsole={true|false}
 如果为 false,则取消对控制台的输出。/ShowCallStack
 如果在安装过程中的任何时候发生异常,则将
调用堆栈输出到日志。
在程序集中使用的各个安装程序可以识别其他
选项。若要了解这些选项,请在命令行上运行 InstallUtil,并在该命令后面带上
程序集的路径和 /? 或 /help 选项。E:\Documents and Settings\zhuanghongguang>

解决方案 »

  1.   

    >>???????????加什么,服务名为:Issue_Service什么代码都不用写,只要在服务属性里设置ServiceName = Issue_Service即可
    其对应的InitializeComponent语句是:
    this.ProjectInstaller.ServiceName = "Issue_Service";
      

  2.   

    在VS.Net开始菜单下-->Visual Studio .NET 工具-->Visual Studio .NET 2003 命令提示,进入命令行状态,会帮你设置一些PATH等环境变量,然后就可以使用了。
      

  3.   

    C:\WINNT\Microsoft.NET\Framework\v1.1.4322>installutil F:\mycode\Issue\bin\Debug
    \Issue.exe
    Microsoft (R) .NET Framework 安装实用工具版本 1.1.4322.573
    Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
    正在运行事务处理安装。正在开始安装的“安装”阶段。
    查看日志文件的内容以获得 f:\mycode\issue\bin\debug\issue.exe 程序集的进度。
    该文件位于 f:\mycode\issue\bin\debug\issue.InstallLog。
    正在安装程序集“f:\mycode\issue\bin\debug\issue.exe”。
    受影响的参数是:
       assemblypath = f:\mycode\issue\bin\debug\issue.exe
       logfile = f:\mycode\issue\bin\debug\issue.InstallLog
    正在安装服务 Issue_Service...
    正在日志 Application 中创建 EventLog 源 Issue_Service...在“安装”阶段发生异常。
    System.ComponentModel.Win32Exception: 帐户名无效或不存在,或者密码对于指定的帐户
    名无效。正在开始安装的“回滚”阶段。
    查看日志文件的内容以获得 f:\mycode\issue\bin\debug\issue.exe 程序集的进度。
    该文件位于 f:\mycode\issue\bin\debug\issue.InstallLog。
    正在回滚程序集“f:\mycode\issue\bin\debug\issue.exe”。
    受影响的参数是:
       assemblypath = f:\mycode\issue\bin\debug\issue.exe
       logfile = f:\mycode\issue\bin\debug\issue.InstallLog
    正在将事件日志还原到源 Issue_Service 的前一状态。“回滚”阶段已成功完成。已完成事务处理安装。
    安装失败,已执行回滚。C:\WINNT\Microsoft.NET\Framework\v1.1.4322>
      

  4.   

    把serviceProcessInstaller1的Account设置为“LocalSystem”
      

  5.   

    正在运行事务处理安装。正在开始安装的“安装”阶段。
    查看日志文件的内容以获得 f:\mycode\issue\bin\debug\issue.exe 程序集的进度。
    该文件位于 f:\mycode\issue\bin\debug\issue.InstallLog。
    正在安装程序集“f:\mycode\issue\bin\debug\issue.exe”。
    受影响的参数是:
       assemblypath = f:\mycode\issue\bin\debug\issue.exe
       logfile = f:\mycode\issue\bin\debug\issue.InstallLog
    正在安装服务 Issue_Service...
    正在日志 Application 中创建 EventLog 源 Issue_Service...在“安装”阶段发生异常。
    System.InvalidOperationException: 安装因缺少 ServiceProcessInstaller 而失败。Ser
    viceProcessInstaller 必须是安装程序的组成部分,或存在于和 ServiceInstaller 相同
    的安装程序上的 Installers 集合中。正在开始安装的“回滚”阶段。
    查看日志文件的内容以获得 f:\mycode\issue\bin\debug\issue.exe 程序集的进度。
    该文件位于 f:\mycode\issue\bin\debug\issue.InstallLog。
    正在回滚程序集“f:\mycode\issue\bin\debug\issue.exe”。
    受影响的参数是:
       assemblypath = f:\mycode\issue\bin\debug\issue.exe
       logfile = f:\mycode\issue\bin\debug\issue.InstallLog
    正在将事件日志还原到源 Issue_Service 的前一状态。“回滚”阶段已成功完成。已完成事务处理安装。
    安装失败,已执行回滚。
    //天啦,怎么这么麻烦啊?
    //安装因缺少 ServiceProcessInstaller 而失败
    先谢谢:FJGoodGood(_FJ_强中强)
    解决问题后加分,绝不实言~
      

  6.   

    >>System.InvalidOperationException: 安装因缺少 ServiceProcessInstaller 而失败。说明你没有为服务添加ProjectInstaller类,照这个做:
    1)在“解决方案资源管理器”中,访问要向其中添加安装组件的服务的“设计”视图。 
    2)单击设计器表面的任意一处。 
    3)在“属性”窗口的“说明”区域中,单击“添加安装程序”链接。 
    这时项目中就添加了一个新类 ProjectInstaller 和两个安装组件 ServiceProcessInstaller 和 ServiceInstaller,并且服务的属性值被复制到组件。 4)单击 ServiceInstaller 组件,验证 ServiceName 属性的值是否设置为与服务本身的 ServiceName 属性值相同。 ....
      

  7.   

    msdn上有教程:
    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/vbcon/html/vbwlkwalkthroughcreatingwindowsserviceapplication.htm
      

  8.   

    InstallUtil.exe servicename.exe 装
    InstallUtil.exe servicename.exe /u 卸