VS 2008 Windows 服务安装程序不起作用 [英] VS 2008 Windows Service Installer Doesn't work

查看:24
本文介绍了VS 2008 Windows 服务安装程序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个新的 Windows 服务,但安装程序出现问题.

I just created a new windows service and I am having issues with the installer.

我通过本教程创建了安装程序:http://www.sarin.mobi/2008/08/c-windows-service-visual-studio-2008/

I created the installer via this tutorial: http://www.sarin.mobi/2008/08/c-windows-service-visual-studio-2008/

无论如何,当我运行 VS 生成的 .msi 时,该项目的可执行文件安装在我期望的位置.但是,该服务不会出现在 Windows 服务中.

Anyway, when I run the .msi generated by VS, the executable for this project is installed where I expect it to be. However, the service does not appear in Windows Services.

当我使用 VS 命令行工具和 installutil 时,一切正常.

When I use the VS command line tool and installutil, everything works just fine.

我过去创建过服务,因此我将 ProjectInstaller 文件和安装程序配置与过去的项目进行了比较,没有发现显着差异.

I have created services in the past, so I compared the ProjectInstaller files and the installer configuration with past projects and see no significant differences.

有什么建议吗?

推荐答案

要安装一个服务,需要在服务项目中添加一个ServiceInstaller和一个ServiceProcessInstaller,然后将自定义操作添加到安装程序以运行它们.我很确定这是您缺少的自定义操作部分.

To install a service, you need to add a ServiceInstaller and a ServiceProcessInstaller to the service project, then add custom actions to the installer to run them. I'm pretty sure it's the custom actions part you're missing.

  1. 创建一个新的 Windows 服务项目
  2. 双击 .svc 文件以打开设计器.
  3. 右键单击设计图面并选择创建安装程序".这将创建一个.
  4. 设置属性...关键道具是:
    • ServiceInstaller:名称和启动类型
    • ServiceProcessInstaller:运行的帐户.

现在,当您构建并执行安装程序时,您在第 3 步中创建的安装程序将被执行,添加您的服务并设置所有属性.

Now when you build the installer and execute it, the installers you've created in step 3 will be executed, adding your service and setting all properties.

HTH,
詹姆斯

HTH,
James

这篇关于VS 2008 Windows 服务安装程序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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