Installer C# Service sur Windows Serveur (Accès Refusé)

J'ai créé un C# service. Maintenant je veux installer ce service sur Windows Server 2008 R2.
Je suis l'aide de la InstallUtil de commande pour installer le service. J'ai ouvert l'invite de commande en tant qu'administrateur.

Le service doit s'exécuter comme un certain utilisateur, donc j'ai mis le compte d'utilisateur sur le Service programme d'installation.

Lorsque je lance la commande, j'obtiens une erreur:

Une exception s'est produite lors de l'Installation de la phase:
System.ComponentModel.Win32Exception: Access Denied.

Voici le fichier de log:

Installing assembly 'C:\Service\MyService.exe'.
Affected parameters are:
   logtoconsole = 
   logfile = C:\Service\MyService.InstallLog
   assemblypath = C:\Service\MyService.exe
Rolling back assembly 'C:\Service\MyService.exe'.
Affected parameters are:
   logtoconsole = 
   logfile = C:\Service\MyService.InstallLog
   assemblypath = C:\Service\MyService.exe
An exception occurred during the Rollback phase of the System.ServiceProcess.ServiceProcessInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an object.
An exception occurred during the Rollback phase of the installation. This exception will be     ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.

Voici ce qui est affiché sur l'invite de commande:

Beginning the Install phase of the installation.
See the contents of the log file for the C:\Service\MyService.exe assembly's progress.
The file is located at C:\Service\MyService.InstallLog.
Installing assembly 'C:\Service\MyService.exe'.
Affected parameters are:
logtoconsole =
logfile = C:\Service\MyService.InstallLog
assemblypath = C:\Service\MyService.exe
An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: Access Denied
at System.ServiceProcess.ServiceProcessInstaller.OpenSecurityPolicy()
at System.ServiceProcess.ServiceProcessInstaller.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.AssemblyInstaller.Install(IDictionary savedState)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\Service\MyService.exe assembly's progress.
The file is located at C:\Service\MyService.InstallLog.
Rolling back assembly 'C:\Service\MyService.exe'.
Affected parameters are:
logtoconsole =
logfile = C:\Service\MyService.InstallLog
assemblypath = C:\Service\MyService.exe
An exception occurred during the Rollback phase of the System.ServiceProcess.Ser
viceProcessInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will 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.

Est-ce que qqn sait ce que je dois faire pour installer le service?

avez-vous de code personnalisé dans isntaller?
Il n'existe pas de code spécifique dans le programme d'installation.
J'ai maintenant créé un nouveau projet de service dans Visual Studio et a tenté d'installer ce service sur le serveur. J'ai eu le même message d'erreur.
Avez-vous démarrer l'invite de commande avec des autorisations élevées? Le Run as Admin option lorsque vous cliquez droit sur elle.
Oui j'ai ouvert l'invite de commande avec des autorisations élevées.

OriginalL'auteur Alexander | 2013-03-11