不使用 InstallUtil.exe 安装 windows 服务 [英] Install windows service without InstallUtil.exe

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

问题描述

我正在尝试部署 Windows 服务,但不太确定如何正确执行.我将它构建为一个控制台应用程序,现在我已经将它变成了一个 Windows 服务项目,只需从服务中的 OnStart 方法调用我的类.

I'm trying to deploy a windows service but not quite sure how to do it right. I built it as a console app to start with, I've now turned it into a windows service project and just call my class from the OnStart method in the service.

我现在需要在没有 Visual Studio 的服务器上安装它,如果我理解正确,这意味着我不能使用 InstallUtil.exe 而必须创建一个安装程序类.这是正确的吗?

I now need to install this on a server which doesn't have Visual Studio on it, which if I've understood it correctly means I can't use the InstallUtil.exe and have to create an installer class instead. Is this correct?

我确实看过上一个问题,安装一个 .NET windows 服务没有 InstallUtil.exe,但我只是想确保我已经正确理解它.

I did have a look at a previous question, Install a .NET windows service without InstallUtil.exe, but I just want to make sure I've understood it correctly.

如果我创建该问题的已接受答案链接到的班级,下一步是什么?上传MyService.exe和MyService.exe.config到服务器,双击exe文件,Bob是我叔?

If I create the class that question's accepted answer links to, what is the next step? Upload MyService.exe and MyService.exe.config to the server, double click the exe file and Bob's my uncle?

该服务只会安装在一台服务器上.

The service will only ever be installed on one server.

推荐答案

InstallUtil.exe 工具只是对服务中的安装程序组件的一些反射调用的封装.因此,它实际上并没有做太多事情,而是锻炼了这些安装程序组件提供的功能.Marc Gravell 的解决方案只是提供了一种从命令行执行此操作的方法,因此您不再需要依赖目标计算机上的 InstallUtil.exe.

The InstallUtil.exe tool is simply a wrapper around some reflection calls against the installer component(s) in your service. As such, it really doesn't do much but exercise the functionality these installer components provide. Marc Gravell's solution simply provides a means to do this from the command line so that you no longer have to rely on having InstallUtil.exe on the target machine.

这是我基于 Marc Gravell 解决方案的分步说明.

Here's my step-by-step that based on Marc Gravell's solution.

如何安装后立即启动 .NET Windows 服务?

这篇关于不使用 InstallUtil.exe 安装 windows 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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