11

C# サービスを作成しました。今、そのサービスを Windows Server 2008 R2 にインストールしたいと考えています。InstallUtilコマンドを使用してサービスをインストールしています。コマンドプロンプトを管理者として開きました。

サービスは特定のユーザーとして実行する必要があるため、サービス インストーラーでアカウントをユーザーに設定します。

コマンドを実行すると、エラーが発生します。

インストール フェーズ中に例外が発生しました: System.ComponentModel.Win32Exception: Access Denied

ログファイルは次のとおりです。

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.

コマンドプロンプトに表示される内容は次のとおりです。

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.

サービスをインストールするために何をする必要があるか誰かが知っていますか?

4

3 に答える 3

9

やっとサービスをインストールできました。サーバー管理者という役割でサーバーにログインしました。管理者が私のアカウントをサーバーのローカル管理者グループに追加しました。この後、サービスをインストールできました。システムへのログインに使用したサーバー管理者アカウントには、完全な管理者権限がありませんでした。

ご協力いただきありがとうございます。

于 2013-03-19T14:51:03.930 に答える
2

あなたのサービスが何をするかについての詳細を本当に提供していないので、私はまだあなたの投稿に直接コメントすることはできませんが、このリンクを試してみてください.

これの要約は、適切な 32/64 ビットの installutil.exe を実行していることを確認し、マージ モジュールが問題の原因ではないことを確認することです。

おそらく、サービスのより良い説明が役立つでしょうか? サービスは、サーバーではなくローカル マシンに正常にインストールされますか?

于 2013-03-17T17:12:12.800 に答える