Nitin Jain Nitin Jain - 2 months ago 19
C# Question

64 bit Windows Service become disable on uninstall

I created a 64 bit windows service using VS-2013, framework-4.5.1. I am installing this windows service using 64 bit framework utility installUtil.exe located at "C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319". 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"

To Uninstall Service

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.