我有一个 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...");
}
请您参考如下方法:
首先卸载已经安装的服务:
InstallUtil.exe /u GestoreService.exe
然后重新安装:
InstallUtil.exe GestoreService.exe
