在没有InstallUtil.exe的情况下安装Windows服务 [英] Install windows service without InstallUtil.exe

查看:257
本文介绍了在没有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?

我确实看过上一个问题,安装不带InstallUtil.exe的.NET Windows服务,但我只想确保我已正确理解它。

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 Service? / a>

How to make a .NET Windows Service start right after the installation?

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

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