本文介绍了关于使用命令提示符安装 Windows 服务的困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 .NET 2.0 中设计了一个简单的 Windows 服务.

I have designed a simple windows service in .NET 2.0.

我正在尝试将其部署在我的本地计算机上.我已切换到设计视图,并设置 ServiceInstaller 和 ServiceProcessInstaller 对象.有一个项目安装程序.我还将 Windows 服务包装到一个 .NET 安装项目中并安装它,在指定目录中留下一个 .exe.

I am trying to deploy it on my local machine. I have switched to design view, and setup ServiceInstaller and ServiceProcessInstaller objects. There is a Project Installer. I have also wrapped the Windows Service into a .NET setup project and install it, leaving an .exe in the specified directory.

我已经启动了 cmd 并输入了 installutil 的路径.这工作正常,但随后我在 Visual Studio 命令提示符下键入 installutil 和服务的完整路径,但这不起作用(我也试过 installutil/i 和各种出于绝望的事情).权限是本地系统(扩展).

I have fired up cmd and entered the path to installutil. This works fine, but then I typeinstallutil and the full path to the service, in Visual Studio command prompt, and this does not work (I've also tried installutil /i and all sorts of things out of desperation). The permissions are local system (extensive).

任何想法我做错了什么?对于已经安装 Windows 服务的用户,您安装该服务的方法是什么?

Any ideas what I am doing wrong? For those here who have installed Windows Services, what was your methodology to install the service?

谢谢

推荐答案

我们实际上创建了一个内置于我们的应用程序的安装程序.这是一个控制台应用程序,具有用于安装/卸载服务器以及作为服务或以控制台模式运行的命令行.

We actually create an installer built into our application. It's a console app that has a command line to install/uninstall the server as well as run as a service or in console mode.

请参阅这篇关于自安装服务的文章,了解一些细节.我喜欢这种方法,因为它提供了灵活性.

See this article on a Self Installing Service for some details. I like this method as it provides flexibility.

这篇关于关于使用命令提示符安装 Windows 服务的困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 06:30