找不到Windows服务(刚刚安装)

use*_*487 15 c# windows-services .net-4.0 visual-studio-2010 windows-7

我刚刚使用VS 2010安装了Windows服务,使用installutil.exe,cmd提示窗口表示提交阶段已成功完成,但我无法在本地服务文件夹中看到Windows服务.

我在这里想念的是什么?

我使用的是Windows 7和VS 2010

更新:
我卸载了服务(名为service1),将名称更改为有意义的东西,安装了服务(与上面相同的过程),仍然无法在服务浏览器中找到它.

FWIW ...我在属性窗口(文件名值)中重命名了我的service1.cs ..但它仍然在服务浏览器中显示service1.我最后也改变了代码中的值(自动生成的代码)this.serviceInstaller1.ServiceName ="service1";

更新(2) 我创建了一个虚拟Windows服务,并且能够成功安装(它提示我输入域登录ID和密码),我能够在服务浏览器中看到它.

但是,我无法在服务浏览器中看到实际的Windows服务(与我的项目相关).显然我有权限,因为我能够安装虚拟服务.

根据这个网站安装后无法看到Windows服务

我在"HKLM\System\CurrentControlSet\Services"路径中看不到注册表中的服务.

更新(3)
日志文件说

在C:中找不到具有RunInstallerAttribute.Yes属性的公共安装程序.

但是,我在项目解决方案中有一个ProjectInstaller.cs文件.

我补充道

[runInstaller的(真)]

到ProjectInstaller.cs文件,仍然没有运气

任何建议?

Ben*_*ams 9

还要记住,在列表中查找之前,请检查您提供服务的名称.我从网上复制粘贴了一些代码,忘了在代码中更改服务的名称,所以当然我找不到它......

serviceInstaller.DisplayName = "Example service"
Run Code Online (Sandbox Code Playgroud)

卫生署!


Żub*_*wka 5

使用 [RunInstaller(true)] 属性检查 Installer 派生类的构造函数中是否有类似的内容:

public ServiceSetup()
{
    Installers.Clear();

    ServiceInstaller serviceInstaller = new ServiceInstaller();
    // serviceInstaller.Description = // FIXME:
    // serviceInstaller.ServiceName = // FIXME:
    // serviceInstaller.DisplayName = // FIXME:
    serviceInstaller.StartType = ServiceStartMode.Automatic;
    Installers.Add(serviceInstaller);

    ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
    serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
    serviceProcessInstaller.Username = null;
    serviceProcessInstaller.Password = null;
    Installers.Add(serviceProcessInstaller);
}
Run Code Online (Sandbox Code Playgroud)


Dav*_*ler 2

将添加 [RunInstaller(true)] 的类公开。