title: Installing a windows service as a user fails
body: <p>I'm developing a windows service using .Net framework version 3.5. It needs to call a web service on a remote machine and I'm running into a weird installation problem.</p>
  
  <p>I used to install it on my machine as <code>User</code> (the default), and when prompted provided my login and password and everything worked fine. Then at some point, it stopped working, and I found out about installing it as <code>LocalSystem</code> and that worked fine.</p>
  
  <p>Now I'm trying to call the remote web service and I'm getting an error from WCF: </p>
  
  <pre><code>There was no endpoint listening at https://www.remote.com/webservice.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
  </code></pre>
  
  <p>Apparently, this could be due to running the service as <code>LocalSystem</code> (which doesn't have internet access) : <a href="https://stackoverflow.com/questions/1699751/there-was-no-endpoint-listening-at-uri-that-could-accept-the-message-this-is-o">There was no endpoint listening at &lt;URI&gt; that could accept the message. This is often caused by an incorrect address or SOAP action</a></p>
  
  <p>So, I've tried to switch back to installing the service as <code>User</code> and providing my credentials (I should note at this point that I'm an administrator of my machine). But it doesn't work, and the error message (and the contents of the InstallUtil log file) are next to useless:</p>
  
  <pre><code>Running a transacted installation.
  
  Beginning the Install phase of the installation.
  See the contents of the log file for the Service.exe assembly's progress.
  The file is located at Service.InstallLog.
  
  An exception occurred during the Install phase.
  System.InvalidOperationException: An exception occurred in the OnAfterInstall event handler of System.ServiceProcess.ServiceInstaller.
  The inner exception System.InvalidOperationException was thrown with the following error message: Service ServiceName was not found on computer '.'.
  The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: The specified service does not exist as an installed service.
  
  The Rollback phase of the installation is beginning.
  See the contents of the log file for the Service.exe assembly's progress.
  The file is located at Service.InstallLog.
  
  The Rollback phase completed successfully.
  
  The transacted install has completed.
  </code></pre>
  
  <p>As far as I can tell the relevant bit is that the service failed to install. No more information! Any ideas why a service might install successfully as <code>LocalSystem</code> but fail when installing as <code>User</code> who is a member of the Administrators group?</p>