如何卸载 windows 服务
How to unistall windows service
我有一个 windows 服务。
现在我想卸载它并重新安装它但是如果我尝试使用此命令安装它会出现此错误:
InstallUtil.exe GestoreService.exe
错误是
It and exception occurred During Installation .
System.ArgumentException : Origin GestoreService already existing in the local computer
如何修复此错误?
这是主要代码:
public GestoreService()
{
InitializeComponent();
try
{
if (!System.Diagnostics.EventLog.SourceExists("LoggerGestore"))
{
System.Diagnostics.EventLog.CreateEventSource(
"LoggerGestore", "LoggerGestore");
}
}
catch (Exception e)
{
log.Error(e);
}
log.Info("preparazione file di config in corso...");
}
已安装的服务在卸载前无法再次安装。您需要使用 /uninstall 开关才能卸载服务,您可以在 Installutil.exe (Installer Tool)
上了解有关 installutil 的更多信息
作为附加说明,如果您想更新某些服务库 .exe 文件,那么您不需要卸载并重新安装它。您所要做的就是停止服务,替换旧文件(Assemblies/.exe)并再次启动它。
InstallUtil.exe GestoreService.exe /uninstall
或者您可以使用 /uninstall
的缩写作为 /u
InstallUtil.exe /u GestoreService.exe
首先卸载已经安装的服务:
InstallUtil.exe /u GestoreService.exe
然后重新安装:
InstallUtil.exe GestoreService.exe
我有一个 windows 服务。 现在我想卸载它并重新安装它但是如果我尝试使用此命令安装它会出现此错误:
InstallUtil.exe GestoreService.exe
错误是
It and exception occurred During Installation . System.ArgumentException : Origin GestoreService already existing in the local computer
如何修复此错误?
这是主要代码:
public GestoreService()
{
InitializeComponent();
try
{
if (!System.Diagnostics.EventLog.SourceExists("LoggerGestore"))
{
System.Diagnostics.EventLog.CreateEventSource(
"LoggerGestore", "LoggerGestore");
}
}
catch (Exception e)
{
log.Error(e);
}
log.Info("preparazione file di config in corso...");
}
已安装的服务在卸载前无法再次安装。您需要使用 /uninstall 开关才能卸载服务,您可以在 Installutil.exe (Installer Tool)
上了解有关 installutil 的更多信息作为附加说明,如果您想更新某些服务库 .exe 文件,那么您不需要卸载并重新安装它。您所要做的就是停止服务,替换旧文件(Assemblies/.exe)并再次启动它。
InstallUtil.exe GestoreService.exe /uninstall
或者您可以使用 /uninstall
的缩写作为 /u
InstallUtil.exe /u GestoreService.exe
首先卸载已经安装的服务:
InstallUtil.exe /u GestoreService.exe
然后重新安装:
InstallUtil.exe GestoreService.exe