Ошибка установки службы Windows с помощью InstallUtil.exe - PullRequest
6 голосов
/ 31 мая 2011

У меня возникли некоторые проблемы при установке моей службы Windows.

Я следовал инструкциям Мэтта, чтобы создать свою службу: Самый простой язык для создания службы Windows

ServiceAccountустановлен на User, хотя я пробовал LocalService, LocalSystem и NetworkService.

Цель моей службы Windows - создать хост для моей службы WCF.Я использую 64-разрядную версию Win 7 Prof.

В PowerShell с привилегиями администратора я выполнил следующее:

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, но безуспешно.Пожалуйста, дайте мне знать, если вам нужна дополнительная информация.

Я испытываю желание использовать метод Мэтта для установки службы Windows здесь: Как запустить службу .NET Windows сразу после установки? ,Хотя, я волнуюсь, у меня возникнут подобные проблемы.

Спасибо

1 Ответ

4 голосов
/ 01 июня 2011

Попробуйте переместить службу и ее зависимости на диск C: и повторите попытку, особенно если H: это сетевой диск.

...