简体   繁体   English

64位Windows服务在卸载时变为禁用

[英]64 bit Windows Service become disable on uninstall

I created a 64 bit windows service using VS-2013, framework-4.5.1. 我使用VS-2013框架4.5.1创建了64位Windows服务。 I am installing this windows service using 64 bit framework utility installUtil.exe located at "C:\\WINDOWS\\Microsoft.NET\\Framework64\\v4.0.30319". 我正在使用位于“ C:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319”的64位框架实用程序installUtil.exe安装此Windows服务。 This is installing successfully but when i am trying to uninstall it becomes disable and all the time i have to restart machine. 这已成功安装,但是当我尝试卸载时,它变得禁用,并且所有时间我都必须重新启动计算机。 Command i used to install and uninstall are mention below. 下面提到我用来安装和卸载的命令。

To Install Service 安装服务

C:\\WINDOWS\\Microsoft.NET\\Framework64\\v4.0.30319\\InstallUtil.exe "C:\\MyWindowsServicePath\\MyWindowsSerivce.exe" C:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ InstallUtil.exe“ C:\\ MyWindowsServicePath \\ MyWindowsSerivce.exe”

To Uninstall Service 卸载服务

C:\\WINDOWS\\Microsoft.NET\\Framework64\\v4.0.30319\\InstallUtil.exe /u "C:\\MyWindowsServicePath\\MyWindowsSerivce.exe" C:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ InstallUtil.exe / u“ C:\\ MyWindowsServicePath \\ MyWindowsSerivce.exe”

I found the error. 我发现了错误。 This is my mistake. 这是我的错 I have some code on service stop event and this code has some error. 我在服务停止事件上有一些代码,此代码有一些错误。 So when i uninstall service, framework try to stop it first and that causing my service is getting disable. 因此,当我卸载服务时,框架会尝试先停止它,从而导致我的服务被禁用。 As i fixed my code error every thing is working fine. 当我修复代码错误时,一切正常。

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

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