问题描述
我使用VS 2012,由于已从其中删除安装项目,因此必须使用InstallUtil.exe.
I use VS 2012 and since the setup projects have been removed from it I have to use InstallUtil.exe.
我的Windows Service应用程序中没有projectInstaller类.我在命令提示符下运行:
I don't have projectInstaller class in my windows service app. I run in command prompt:
installutil FilesMonitoringService.exe
我得到:
运行事务处理的安装.
开始安装的安装阶段.请参阅C:\ Program Files \ Microsoft Visual Studi日志文件的内容o 8 \ VC#\ CSharpProjects \ MyService \ MyService \ bin \ Release \ MyService.exe程序集的进步.该文件位于C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MyService \ MyService \ bin \ Release \ MyService.InstallLog.安装程序集'C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MyService \ MyService \ bin \ Release \ MyService.exe".受影响的参数是:logtoconsole =assemblypath = C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \MyService \ MyService \ bin \ Release \ MyService.exe日志文件= C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MySerVice \ MyService \ bin \ Release \ MyService.InstallLog找不到带有RunInstallerAttribute.Yes属性的公共安装程序在C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MyService \MyService \ bin \ Release \ MyService.exe程序集.
Beginning the Install phase of the installation. See the contents of the log file for the C:\Program Files\Microsoft Visual Studi o 8\VC#\CSharpProjects\MyService\MyService\bin\Release\MyService.exe assembly's progress. The file is located at C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProj ects\MyService\MyService\bin\Release\MyService.InstallLog. Installing assembly 'C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjec ts\MyService\MyService\bin\Release\MyService.exe'. Affected parameters are: logtoconsole = assemblypath = C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\ MyService\MyService\bin\Release\MyService.exe logfile = C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\MySer vice\MyService\bin\Release\MyService.InstallLog No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\MyService\ MyService\bin\Release\MyService.exe assembly.
安装"阶段已成功完成,并且提交"阶段已开始.请参阅C:\ Program Files \ Microsoft Visual Studi日志文件的内容o 8 \ VC#\ CSharpProjects \ MyService \ MyService \ bin \ Release \ MyService.exe程序集的进步.该文件位于C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MyService \ MyService \ bin \ Release \ MyService.InstallLog.提交程序集'C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MyService \ MyService \ bin \ Release \ MyService.exe".受影响的参数是:logtoconsole =assemblypath = C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \MyService \ MyService \ bin \ Release \ MyService.exe日志文件= C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MySerVice \ MyService \ bin \ Release \ MyService.InstallLog找不到带有RunInstallerAttribute.Yes属性的公共安装程序在C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MyService \MyService \ bin \ Release \ MyService.exe程序集.删除InstallState文件,因为没有安装程序.
The Install phase completed successfully, and the Commit phase is beginning. See the contents of the log file for the C:\Program Files\Microsoft Visual Studi o 8\VC#\CSharpProjects\MyService\MyService\bin\Release\MyService.exe assembly's progress. The file is located at C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProj ects\MyService\MyService\bin\Release\MyService.InstallLog. Committing assembly 'C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjec ts\MyService\MyService\bin\Release\MyService.exe'. Affected parameters are: logtoconsole = assemblypath = C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\ MyService\MyService\bin\Release\MyService.exe logfile = C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\MySer vice\MyService\bin\Release\MyService.InstallLog No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\MyService\ MyService\bin\Release\MyService.exe assembly. Remove InstallState file because there are no installers.
提交阶段成功完成.
交易安装已完成.
C:\ Program Files \ Microsoft Visual Studio 8 \ VC#>
C:\Program Files\Microsoft Visual Studio 8\VC#>
确定,似乎一切都已安装.但!当我转到任务管理器进入服务"页面时,找不到我的服务.
OK, seems like everything have been installed. But! When I go to task manager to the Services page I can't find my service.
可能是什么原因?
提前谢谢!
我指出我没有projectInstaller类,因为如果我添加它(在设计器中-> add installer)并运行installutil命令,我会得到:(近似翻译)
Edits: I pointed out that I don't have projectInstaller class because if I add it (in designer -> add installer) and run installutil command I get: (approximate translation)
在此设置阶段,发生了异常.
On this setup stage the exception occured.
反冲阶段开始.
//很多文本
后坐力阶段成功
已执行设置组操作.安装失败,后坐力已执行.
Setup group operation executed. Setup failed and recoil was executed.
因此,如果我将projectInstller添加到Windows服务中,则肯定无法通过installUtil安装.
这是生成的代码:
So, if I add projectInstller to my windows service it definitely fails to install with installUtil.
Here is the generated code:
[RunInstaller(true)]
public partial class ProjectInstaller : Installer
{
public ProjectInstaller()
{
InitializeComponent();
}
private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
{}
private void serviceProcessInstaller1_AfterInstall(object sender, InstallEventArgs e)
{}
}
Mabby我需要在afterInstall方法中放入一些代码吗?我还在 properties
窗口中设置了以下属性:
Mabby I need to put some code into afterInstall methods? I also set this properies in a properties
window:
serviceInstaller1:ServiceName-> FileMonitoringService,StartType->自动
serviceProcessInstaller1:帐户-> LocalSystem
serviceInstaller1: ServiceName -> FileMonitoringService, StartType -> Automatic
serviceProcessInstaller1: Account -> LocalSystem
还是可以在没有projectInstaller的情况下实现?
Or can it be implemented without projectInstaller?
推荐答案
好,有几件事:
1)您需要projectInstaller.
2)YourProject->属性;启动项目-> YourProject.Program
3)建立
4)以管理员身份运行"命令提示符!
1) You need projectInstaller.
2) YourProject -> properties; Startup project -> YourProject.Program
3) build
4) "Run as Administrator" the command prompt!
现在一切正常.
这篇关于无法在InstallUtil工具的帮助下安装Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!