Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Windows service uninstall/install issue
 

Windows service uninstall/install issue

I have a WCF application which I want to expose as a Windows Service. The windows service starts but fails to stop due to some exception in the Stop() method implementation of the installer class. When I try to stop the service it gets into disabled mode, and I am unable to uninstall the windows service.

Please help me to remove the windows service from the system

Thanks.

mahalax  Wednesday, February 28, 2007 5:29 AM

I don't think it's your installer class that's broken, it's the code in your OnStop in the service, so add some diagnostics to it.

As a way to fix up your system and delete the service, the WMI Win32_Service class will do it. Enable the service then use this VBScript as an example, with your service name instead:

dim servicelist, service, fso, a, plist,process,sname

Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("services.txt", True)
Set servicelist= GetObject("winmgmts:").InstancesOf ("Win32_Service")
msg = ""
for each service in servicelist
a.writeline ("Displayname = " & service.displayname & " Name = " & service.name & " Started = " & service.started & " State = " & service.state & " Tagid=" & service.TagID)
sname=lcase(service.name)
If left(sname, 8) = "service1" And service.state ="Running" Then service.stopservice
If left(sname,8)="service1" Then
service.delete
msgbox "delete"
end if
next

PhilWilson  Thursday, March 01, 2007 7:16 PM

Yes, I got it done. Thanks.

Can a Windows Service access certificates in a user/system store in the computer.The WCF service I need to expose predominantly requires to access the certificates for authentication purposes.

Thanks.

mahalax  Friday, March 02, 2007 11:09 AM

You can use google to search for other answers

Custom Search

More Threads

• The remote server returned an error: (401) Unauthorized.
• Why IIS is needed to host controls in IE ?
• check for a already installed program
• ClickOnce - Wasted Disk Space
• No access to Add/Remove programs??
• a problem with msi file
• Can any one give some thoughts on Launching one ClickOnce Application from another ClickOnce Application using Application Reference with some Parameters
• Custom Action Not Being Called - Can't Figure Out Why
• Associate a (system wide) shortcut key to a desktop shortcut
• Deploy Project built in XP won't run on Server 2003