Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing Windows Service using InstallUtil.exe

I am having some issues installing my Windows Service.

I followed Matt's instructions here to create my service: Easiest language for creating a Windows service

The ServiceAccount is set to User, although I have tried LocalService, LocalSystem and NetworkService.

The purpose of my Windows Service is to create a Host for my WCF Service. I am running Win 7 64-bit Prof.

I ran the following in PowerShell w/ Admin Privelages:

PS C:\windows\Microsoft.NET\Framework64\v2.0.50727> ./installutil "H:\<omitted>\Host Windows Service.exe"

I received the following error:

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:\<omitted>\Host Windows Service.exe assembly's progress.
The file is located at H:\<omitted>\Host Windows Service.InstallLog.
Installing assembly 'H:\<omitted>\Host Windows Service.exe'.
Affected parameters are:
   assemblypath = H:\<omitted>\Host Windows Service.exe
   logfile = H:\<omitted>\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:\<omitted>\Host Windows Service.exe assembly's progress.
The file is located at H:\<omitted>\Host
 Windows Service.InstallLog.
Rolling back assembly 'H:\<omitted>\Host Windows Service.exe'.
Affected parameters are:
   assemblypath = H:\<omitted>\Host Windows Service.exe
   logfile = H:\<omitted>\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.

I even tried disabling UAC altogether with no luck. Please let me know if you need more info.

I am tempted to use Matt's method for installing a Windows Service here: How to make a .NET Windows Service start right after the installation? . Although, I am worried I will run into similar problems.

Thanks

like image 987
Ryan R Avatar asked May 31 '11 19:05

Ryan R


1 Answers

Try moving the service and its dependencies to the C: drive and trying again, especially if H: is a network drive.

like image 115
Matt Davis Avatar answered Sep 22 '22 12:09

Matt Davis