简体   繁体   English

MMC无法看到已安装的.NET服务

[英]MMC can't see installed .NET service

I have a .NET windows service project and a deployment project to create an MSI for the service. 我有一个.NET Windows服务项目和一个用于为该服务创建MSI的部署项目。 I've installed/uninstalled the service numerous times during development but seem to have broken something. 在开发过程中,我已经多次安装/卸载了该服务,但似乎已经损坏了一些东西。 The service appears to install and the program files exist as expected, the Windows add/remove program sees the new program but the Management Console (MMC) does not list the newly installed service. 该服务似乎已安装,并且程序文件按预期存在,Windows添加/删除程序可以看到新程序,但管理控制台(MMC)不会列出新安装的服务。

How can I get MMC to recognize this service exists? 如何让MMC识别此服务存在? It was working fine (appearing in MMC as expected) for a while. 一段时间后,它的运行状况良好(按预期出现在MMC中)。 During one uninstall the software was removed but the service remained listed in MMC (obviously it wouldn't start). 在一次卸载期间,该软件被删除,但该服务仍在MMC中列出(显然它无法启动)。 I managed to remove the orphaned service from MMC via Regedit but when I now reinstall the service MMC won't see it. 我设法通过Regedit从MMC删除了孤立服务,但是当我现在重新安装该服务时,MMC将看不到它。

How can I get MMC to see this service when it is installed? 安装后如何让MMC看到此服务?

I know this sounds crazy but have you tried rebooting. 我知道这听起来很疯狂,但您是否尝试过重启。 I know services can be a pain sometimes to register/cleanup during development. 我知道有时在开发过程中注册/清除服务可能会很痛苦。 I remember weird things can happen when you are testing the installer. 我记得在测试安装程序时会发生奇怪的事情。 Another old trick was to click the desktop and hit F5 which can force the registry to reload (or least it used to work sometimes many moons ago). 另一个古老的技巧是单击桌面并单击F5,这可以强制重新加载注册表(或者至少在很多月之前它曾经可以工作)。

Are the registry keys back in the registry? 注册表项是否又回到了注册表中? If not then it's the installer. 如果不是,则为安装程序。 Check to make sure that the service installers (not the msi installer but the classes you added to the service) are executing correctly. 检查以确保服务安装程序(不是msi安装程序,而是您添加到服务中的类)正在正确执行。 You can try using InstallUtil.exe directly and if that works then the msi project isn't picking up the service installer classes in you main project. 您可以尝试直接使用InstallUtil.exe,如果可以,则msi项目不会在您的主项目中使用服务安装程序类。 If not then it's possible the service installer classes aren't set up correctly. 如果不是,则可能是服务安装程序类未正确设置。 I'd create a dummy service project and compare the autogen code to what I have. 我将创建一个虚拟服务项目,并将autogen代码与我的代码进行比较。

Are new versions of the files being copied to the correct places. 是新版本的文件被复制到正确的位置。 It is also possible that the installer thinks the service is already up to date. 安装程序还可能认为该服务已更新。 That should have put up a dialog warning you though but you can check if all else fails. 那应该会弹出一个对话框警告您,但是您可以检查所有其他操作是否失败。 In that case you have to manually delete the files and reg keys again. 在这种情况下,您必须再次手动删除文件和reg键。 If that doesn't work you can use procmon to see what the installer is doing in the registry and in the file system that makes it think the project is already installed. 如果这不起作用,则可以使用procmon在注册表和文件系统中查看安装程序的工作,使其认为该项目已安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM