title: Why can't I install my windows service - Specified service already exists
body: <p>I wish I could put a grenade to my computer at this point. I'm so frustrated because I don't understand why my application won't install using installUtil.</p>
  
  <p>I've just looked through this link now:  <a href="https://stackoverflow.com/questions/18499605/windows-service-install-ends-in-rollback">Windows Service Install Ends in Rollback</a> and unfortunately the kind suggestions on there don't help in my situation, the following error was generated after taking into consideration all of the answers posted by the good people of SO on that link and others. </p>
  
  <p>I have looked for best practices on the web for task parallel processing patterns but there's nothing helpful so far. The latest error I get when attempting to install is as follows:</p>
  
  <blockquote>
    <p>.exe assembly's progress. The file is located at
    E:\xxx\MyService\Service_V2.InstallLog. Installing assembly
    'E:\xxx\MyService\Service_V2.exe'. Affected parameters are:<br>
    logtoconsole =    logfile = E:\xxx\MyService\Service_V2.InstallLog<br>
    assemblypath = E:\xxx\MyService\Service_V2.exe Installing service
    Service V2... Service Service V2 has been successfully installed.
    Creating EventLog source Service V2 in log Application... Installing
    service Service V2... Creating EventLog source Service V2 in log
    Application...</p>
    
    <p>An exception occurred during the Install phase.
    System.ComponentModel.Win32Exception: The specified service already
    exists</p>
    
    <p>The Rollback phase of the installation is beginning. See the contents
    of the log file for the E:\xxx\MyService\Service_V2 .exe assembly's
    progress. The file is located at
    E:\xxx\MyService\Service_V2.InstallLog. Rolling back assembly
    'E:\xxx\MyService\Service_V2.exe'. Affected parameters are:<br>
    logtoconsole =    logfile = E:\xxx\MyService\Service_V2.InstallLog<br>
    assemblypath = E:\xxx\MyService\Service_V2.exe Restoring event log to
    previous state for source Service V2. Restoring event log to previous
    state for source Service V2. Service Service V2 is being removed from
    the system... Service Service V2 was successfully removed from the
    system.</p>
    
    <p>The Rollback phase completed successfully.</p>
    
    <p>The transacted install has completed. The installation failed, and the
    rollback has been performed.</p>
  </blockquote>
  
  <p>There was nothing written to the event log either.</p>
  
  <p>Here is my OnStart() method:</p>
  
  <pre><code>protected override void OnStart(string[] args)
          {
              var tokenSource = new CancellationTokenSource();
              var token = tokenSource.Token;
  
              ErrorLogFileName = "Service_V2Errors" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
              Service_V2LogFile = "Service_V2Log" + DateTime.Now.ToString("yyyy-MM-dd") + ".log";
  
              ErrorLogPath = ConfigurationManager.AppSettings["Errorpath"].ToString();
              CheckBatchRecord = Convert.ToInt32(ConfigurationManager.AppSettings["CheckBatchTime"].ToString());
  
              if (!Directory.Exists(ErrorLogPath))
              {
                  Directory.CreateDirectory(ErrorLogPath);
              }
  
              LogMessage("Starting Service " + DateTime.Now.ToString());
  
              _ErrorLog = new StreamWriter(ErrorLogPath + "//" + ErrorLogFileName, true);
              _ErrorLog.WriteLine("Error, Location, AdditionalInformation", true);
              _ErrorLog.Close();
  
              var t = Task.Run(() =&gt; Service_V2Start(), token);
  
              try
              {
                  t.Wait();
              }
              catch (AggregateException e)
              {
                  LogMessage("Exception messages:");
                  foreach (var ie in e.InnerExceptions)
                      LogMessage(ie.GetType().Name + " : " + ie.Message);
  
                  LogMessage("\nTask status: " + t.Status);       
              }
              finally
              {
                  tokenSource.Dispose();
              }          
          }
  </code></pre>
  
  <p>I have also set the compile mode to release for the final install files compiled.</p>
  
  <p>I have done an "sc delete Servie V2" and I also checked the services console and there is no such service listed there. </p>
  
  <p>I have also tried the InstallUtil.exe -u command to uninstall, but I still get this nitwit error. What should I do now?</p>