Reputation: 165
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"
Upvotes: 1
Views: 837
Reputation: 1
I ran in to this problem but in my case, service is in Starting state due to some issue with database connectivity.
The code is written to connect to database during service start but exception thrown because of invalid connection string caused service status to be in Starting state. After service uninstall, it went to Disabled state.
So, it looks Starting state of the service made the service to be in Disabled state after service uninstall.
Service install and uninstall worked fine after correcting database connection string.
Upvotes: 0
Reputation: 165
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.
Upvotes: 2