简体   繁体   中英

Uninstall a Windows Service in Windows 7

I created a Windows Service using C# code, it was installed and shown in services management panel. I wanted to remove it then.

Here is my command in Developer Command Prompt for VS 2012.

c:\source\MessagingPlatform\2013Q4\MessagingCFE\ServiceHost\bin\Debug>installuti
l /u ServiceHost.exe
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.17929
Copyright (C) Microsoft Corporation.  All rights reserved.



  The uninstall is beginning.
  See the contents of the log file for the c:\source\MessagingPlatform\2013Q4\Mess
  agingCFE\ServiceHost\bin\Debug\ServiceHost.exe assembly's progress.
  The file is located at c:\source\MessagingPlatform\2013Q4\MessagingCFE\ServiceHo
  st\bin\Debug\ServiceHost.InstallLog.
  Uninstalling assembly 'c:\source\MessagingPlatform\2013Q4\MessagingCFE\ServiceHo
  st\bin\Debug\ServiceHost.exe'.
  Affected parameters are:
  logtoconsole =
  logfile = c:\source\MessagingPlatform\2013Q4\MessagingCFE\ServiceHost\bin\Deb
  ug\ServiceHost.InstallLog
  assemblypath = c:\source\MessagingPlatform\2013Q4\MessagingCFE\ServiceHost\bi
  n\Debug\ServiceHost.exe
  No public installers with the RunInstallerAttribute.Yes attribute could be found
  in the c:\source\MessagingPlatform\2013Q4\MessagingCFE\ServiceHost\bin\Debug\Se
  rviceHost.exe assembly.

  The uninstall has completed.

  c:\source\MessagingPlatform\2013Q4\MessagingCFE\ServiceHost\bin\Debug>

However when I refreshed services management panel, the service is still there.

It means that is was not deleted at all. Thanks for advice.

Use the sc command line utility:

sc delete <servicename>

Make sure to use the actual service name here, not the display name.

However, sometimes services cannot be deleted without reboot. It is marked as "disabled" then.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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