需要帮助而无需重新启动即可重新安装 Windows 服务 [英] Need help re-installing a windows service without rebooting

查看:31
本文介绍了需要帮助而无需重新启动即可重新安装 Windows 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2010 中创建了一个新的 Windows 服务项目,并添加了一些代码来将信息输出到事件查看器.每次我做一点改变时,我都会做以下事情:

I have created a new Windows Service Project in Visual Studio 2010 and added a little bit of code to output information to the Event Viewer. Every time I make a little change I do the following:

  1. 停止服务
  2. 卸载服务
  3. 关闭我的服务窗口.
  4. 确保任务管理器中没有运行 mmc 的实例
  5. 重新安装服务

当我尝试第 5 步时,安装失败.如果我再次尝试卸载它,我会收到此服务已被标记为删除".我无法在不重新启动的情况下再次安装该服务.这很不方便.

When I try step 5, it fails install. If I try to uninstall it again, I get "This service has been marked for deletion". I am not able to install the service again without a reboot. This is very inconvenient.

我在网上搜索过,这就是我包含第 3 步和第 4 步的原因.这对我不起作用.问题必须出在我的计算机上,因为我在 VM 实例上卸载和安装服务没有问题.

I have search online and that is my reason for including steps 3 and 4. This just has not worked for me. The problem has to be on my computer because I have no problem uninstalling and installing the service on a VM instance.

我使用的是 Windows 7 并在 Visual Studio 2010 上用 C# 编写我的服务.

I am on Windows 7 and writing my service in C# on Visual Studio 2010.

推荐答案

实际上,您不需要为每一个小改动都卸载服务.您只需要确保该服务完全停止,并且您可以覆盖组成该服务的 DLL,然后重新启动它.

You actually don't need to uninstall the service for every little change. You simply need to make sure that the service is fully stopped and you can overwrite the DLL(s) that make up the service and then start it up again.

这篇关于需要帮助而无需重新启动即可重新安装 Windows 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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