1

I have a windows service. Now I want to unistall it and re-install it but I have this error if I try to install it with this command:

InstallUtil.exe GestoreService.exe

The error is

It and exception occurred During Installation . System.ArgumentException : Origin GestoreService already existing in the local computer

How can I fixed this error?

This is the main code:

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..."); 
}

2 Answers 2

3

First uninstall the service that's already installed:

InstallUtil.exe /u GestoreService.exe

Then re-install:

InstallUtil.exe GestoreService.exe
1

Installed service could not be installed again until it is uninstalled. You need to use /uninstall switch in order to uninstall service, you can learn more about installutil on Installutil.exe (Installer Tool)

As a additional note if you want to update some of libraries of service .exe file then you do not need to uninstall and install it again. All you have to do is to stop the service, replace the the old files (Assemblies/.exe) and start it again.

InstallUtil.exe GestoreService.exe /uninstall

Or you can use short for /uninstall as /u

InstallUtil.exe /u GestoreService.exe

Not the answer you're looking for? Browse other questions tagged or ask your own question.