title: Error installing Windows Service using InstallUtil.exe
body: <p>I am having some issues installing my Windows Service.</p>
  
  <p>I followed Matt's instructions here to create my service:
  <a href="https://stackoverflow.com/questions/593454/easiest-language-for-creating-a-windows-service/593803#593803">Easiest language for creating a Windows service</a></p>
  
  <p>The ServiceAccount is set to User, although I have tried LocalService, LocalSystem and NetworkService.</p>
  
  <p>The purpose of my Windows Service is to create a Host for my WCF Service. I am running Win 7 64-bit Prof.</p>
  
  <p>I ran the following in PowerShell w/ Admin Privelages:</p>
  
  <pre><code>PS C:\windows\Microsoft.NET\Framework64\v2.0.50727&gt; ./installutil "H:\&lt;omitted&gt;\Host Windows Service.exe"
  </code></pre>
  
  <p>I received the following error:</p>
  
  <pre><code>Microsoft (R) .NET Framework Installation utility Version 2.0.50727.4927
  Copyright (c) Microsoft Corporation.  All rights reserved.
  
  Running a transacted installation.
  
  Beginning the Install phase of the installation.
  See the contents of the log file for the H:\&lt;omitted&gt;\Host Windows Service.exe assembly's progress.
  The file is located at H:\&lt;omitted&gt;\Host Windows Service.InstallLog.
  Installing assembly 'H:\&lt;omitted&gt;\Host Windows Service.exe'.
  Affected parameters are:
     assemblypath = H:\&lt;omitted&gt;\Host Windows Service.exe
     logfile = H:\&lt;omitted&gt;\Host Windows S
  ervice.InstallLog
     logtoconsole =
  Unable to create an instance of the Host_Windows_Service.ProjectInstaller installer type.
  System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
  The inner exception System.Security.SecurityException was thrown with the following error message: That assembly does no
  t allow partially trusted callers..
  
  An exception occurred during the Install phase.
  System.InvalidOperationException: Unable to create an instance of the Host_Windows_Service.ProjectInstaller installer ty
  pe.
  The inner exception System.Reflection.TargetInvocationException was thrown with the following error message: Exception h
  as been thrown by the target of an invocation..
  The inner exception System.Security.SecurityException was thrown with the following error message: That assembly does no
  t allow partially trusted callers..
  
  The Rollback phase of the installation is beginning.
  See the contents of the log file for the H:\&lt;omitted&gt;\Host Windows Service.exe assembly's progress.
  The file is located at H:\&lt;omitted&gt;\Host
   Windows Service.InstallLog.
  Rolling back assembly 'H:\&lt;omitted&gt;\Host Windows Service.exe'.
  Affected parameters are:
     assemblypath = H:\&lt;omitted&gt;\Host Windows Service.exe
     logfile = H:\&lt;omitted&gt;\Host Windows Service.InstallLog
     logtoconsole =
  Unable to create an instance of the Host_Windows_Service.ProjectInstaller installer type.
  System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
  The inner exception System.Security.SecurityException was thrown with the following error message: That assembly does no
  t allow partially trusted callers..
  An exception occurred during the Rollback phase of the System.Configuration.Install.AssemblyInstaller installer.
  System.InvalidOperationException: Unable to create an instance of the Host_Windows_Service.ProjectInstaller installer ty
  pe.
  The inner exception System.Reflection.TargetInvocationException was thrown with the following error message: Exception h
  as been thrown by the target of an invocation..
  The inner exception System.Security.SecurityException was thrown with the following error message: That assembly does no
  t allow partially trusted callers..
  An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback wil
  l continue. However, the machine might not fully revert to its initial state after the rollback is complete.
  
  The Rollback phase completed successfully.
  
  The transacted install has completed.
  The installation failed, and the rollback has been performed.
  </code></pre>
  
  <p>I even tried disabling UAC altogether with no luck. Please let me know if you need more info.</p>
  
  <p>I am tempted to use Matt's method for installing a Windows Service here: <a href="https://stackoverflow.com/questions/1195478/how-to-make-a-net-windows-service-start-right-after-the-installation/1195621#1195621">How to make a .NET Windows Service start right after the installation?</a> . Although, I am worried I will run into similar problems.</p>
  
  <p>Thanks</p>