加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 无法在InstallUtil工具的帮助下安装Windows服务

发布时间:2020-12-15 03:56:26 所属栏目:百科 来源:网络整理
导读:我使用VS 2012,由于安装项目已被删除,我必须使用InstallUtil.exe. 我的Windows服务应用程序中没有projectInstaller类.我在命令提示符下运行: installutil FilesMonitoringService.exe 我得到: C:Program FilesMicrosoft Visual Studio 8VC#installutil
我使用VS 2012,由于安装项目已被删除,我必须使用InstallUtil.exe.

我的Windows服务应用程序中没有projectInstaller类.我在命令提示符下运行:

installutil FilesMonitoringService.exe

我得到:

C:Program FilesMicrosoft Visual Studio 8VC#>installutil “C:Program FilesMic
rosoft Visual Studio 8VC#CSharpProjectsMyServiceMyServicebinReleaseMyServ
ice.exe”
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.

Running a transacted installation.

Beginning the Install phase of the installation.
See the contents of the log file for the C:Program FilesMicrosoft Visual Studi
o 8VC#CSharpProjectsMyServiceMyServicebinReleaseMyService.exe assembly’s
progress.
The file is located at C:Program FilesMicrosoft Visual Studio 8VC#CSharpProj
ectsMyServiceMyServicebinReleaseMyService.InstallLog.
Installing assembly ‘C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjec
tsMyServiceMyServicebinReleaseMyService.exe’.
Affected parameters are:
logtoconsole =
assemblypath = C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjects
MyServiceMyServicebinReleaseMyService.exe
logfile = C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjectsMySer
viceMyServicebinReleaseMyService.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could be found
in the C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjectsMyService
MyServicebinReleaseMyService.exe assembly.

The Install phase completed successfully,and the Commit phase is beginning.
See the contents of the log file for the C:Program FilesMicrosoft Visual Studi
o 8VC#CSharpProjectsMyServiceMyServicebinReleaseMyService.exe assembly’s
progress.
The file is located at C:Program FilesMicrosoft Visual Studio 8VC#CSharpProj
ectsMyServiceMyServicebinReleaseMyService.InstallLog.
Committing assembly ‘C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjec
tsMyServiceMyServicebinReleaseMyService.exe’.
Affected parameters are:
logtoconsole =
assemblypath = C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjects
MyServiceMyServicebinReleaseMyService.exe
logfile = C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjectsMySer
viceMyServicebinReleaseMyService.InstallLog
No public installers with the RunInstallerAttribute.Yes attribute could be found
in the C:Program FilesMicrosoft Visual Studio 8VC#CSharpProjectsMyService
MyServicebinReleaseMyService.exe assembly.
Remove InstallState file because there are no installers.

The Commit phase completed successfully.

The transacted install has completed.

C:Program FilesMicrosoft Visual Studio 8VC#>

好的,好像一切都已经安装好了.但!当我去任务管理器到服务页面时,找不到我的服务.

可能是什么原因?

提前致谢!

编辑:我指出我没有projectInstaller类,因为如果我添加它(在设计器中 – >添加安装程序)并运行installutil命令我得到:(近似翻译)

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

在这个安装阶段,发生异常.

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

The recoil stage starts.

// lots of text

The recoil stage has succeded

Setup group operation executed.
Setup failed and recoil was executed.

所以,如果我添加projectInstller到我的Windows服务,它绝对无法安装与installUtil.
这是生成的代码:

[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方法中?我也在属性窗口中设置此属性:

serviceInstaller1:ServiceName – > FileMonitoringService,StartType – >自动
serviceProcessInstaller1:帐户 – >本地系统

还是可以实现没有projectInstaller?

解决方法

好的,有几件事情:

1)你需要projectInstaller.
2)您的项目 – >性能;启动项目 – > YourProject.Program
3)构建
4)“以管理员身份运行”命令提示符!

一切工作现在

complete tutorial link

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读