无法在InstallUtil工具的帮助下安装Windows服务 [英] Unable to install windows service with the help of InstallUtil tool

查看:43
本文介绍了无法在InstallUtil工具的帮助下安装Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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 Studio 8 \ VC#> installutil"C:\ Program Files \ Microsoft Visual Studio 8 \ VC#\ CSharpProjects \ MyService \ MyService \ bin \ Release \ MyService.exe"Microsoft(R).NET Framework安装实用程序版本2.0.50727.42版权所有(c)Microsoft Corporation.保留所有权利.

C:\Program Files\Microsoft Visual Studio 8\VC#>installutil "C:\Program Files\Mic rosoft Visual Studio 8\VC#\CSharpProjects\MyService\MyService\bin\Release\MyServ ice.exe" Microsoft (R) .NET Framework Installation utility Version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.

运行事务处理的安装.

开始安装的安装阶段.请参阅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)

FilesMonitoringService的安装...在日志主要应用程序中创建EventLog FilesMonitoringService ...

Installation of FilesMonitoringService... Creation of EventLog FilesMonitoringService in a log jornal Application...

在此设置阶段,发生了异常.

On this setup stage the exception occured.

System.Security.SecurityException:找不到源,但是找不到任何或所有日志日志.无法使用的新闻:安全性.

System.Security.SecurityException: The source is not found, but failed to find by any or all log jornals. Not available jornals: Security.

反冲阶段开始.

//很多文本

后坐力阶段成功

已执行设置组操作.安装失败,后坐力已执行.

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服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆