我在安装Windows服务时遇到一些问题。
我按照马特的指示来创建我的服务: Easiest language for creating a Windows service
ServiceAccount设置为User,尽管我尝试过LocalService,LocalSystem和NetworkService。
我的Windows服务的目的是为我的WCF服务创建一个主机。我正在运行Win 7 64位教授。
我在PowerShell w / Admin Privelages中运行了以下内容:
PS C:\windows\Microsoft.NET\Framework64\v2.0.50727> ./installutil "H:\<omitted>\Host Windows Service.exe"
我收到以下错误:
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.
我甚至试图完全禁用UAC而没有运气。如果您需要更多信息,请与我们联系。
我很想在这里使用Matt的方法安装Windows服务:How to make a .NET Windows Service start right after the installation?。虽然,我担心我会遇到类似的问题。
由于
答案 0 :(得分:4)
尝试将服务及其依赖项移至C:驱动器并再次尝试,尤其是在H:是网络驱动器的情况下。