VS 2008 Windows 服务安装程序不起作用

编程入门 行业动态 更新时间:2024-10-27 00:32:08
本文介绍了VS 2008 Windows 服务安装程序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我刚刚创建了一个新的 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.

创建一个新的 Windows 服务项目双击 .svc 文件以打开设计器.右键单击设计图面并选择创建安装程序".这将创建一个.设置属性...关键道具是: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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-27 12:07:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1154183.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:安装程序   不起作用   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!