简体   繁体   English

Windows服务安装程序问题,删除Windows服务

[英]Windows Service Setup issue removing the windows service

I'm doing a windows service setup project on VS2008, it has a custom action for setting app.config values. 我正在VS2008上执行Windows服务安装项目,它具有用于设置app.config值的自定义操作。 The setup work fine installing the service and setting the app.config values but when I try to uninstall the service, it removes the files but keep the service registered, so I can install it again using the setup, I need to use "sc delete " in the vs command prompt to proper remove the service... anyone have any idea which could be the issue here? 该安装程序可以很好地安装该服务并设置app.config值,但是当我尝试卸载该服务时,它将删除文件但保持该服务的注册状态,因此我可以使用安装程序再次安装它,我需要使用“ sc delete”在vs命令提示符中正确删除服务...任何人有任何想法可能是这里的问题?

Thank you. 谢谢。

I'm not sure whether you still have this issue or not, but still giving answer so that it helps others. 我不确定您是否仍然遇到此问题,但仍在给出答案以便对他人有所帮助。

Use installer component along with your windows service and override OnBeforeUninstall method and write your own code to unregister the service, such as below 将安装程序组件与Windows服务一起使用,并覆盖OnBeforeUninstall方法,并编写自己的代码以注销该服务,如下所示

{frameworkpath}\InstallUtil.exe /u <serviceinstalledpath>

This should uninstall your service 这应该卸载您的服务

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

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