2013-03-11 14 views
9

C#サービスを作成しました。今、Windows Server 2008 R2にそのサービスをインストールしたいと考えています。 私はInstallUtilコマンドを使用してサービスをインストールしています。私は管理者としてコマンドプロンプトを開いた。WindowsサーバーにC#サービスをインストールする(アクセス拒否)

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

私は、コマンドを実行すると、私はエラーを取得する:

インストールフェーズ中に発生した例外: 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. 

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

+0

isntallerにカスタムコードがありますか? –

+0

インストーラにカスタムコードはありません。 – Alexander

+0

私はVisual Studioで新しい空のサービスプロジェクトを作成し、そのサービスをサーバーにインストールしようとしました。私は同じエラーがあります。 – Alexander

答えて

7

私は最後にサービスをインストールできました。私はサーバー管理者という役割でサーバーにログインしていました。私の管理者は自分のアカウントをサーバーのローカル管理者グループに追加しました。その後、私はサービスをインストールすることができました。それは、私がシステムにログインするために使用したサーバー管理者アカウントのような縫い目は、完全な管理者特権を持っていませんでした。

ありがとうございました。

2

あなたは本当にについてどのような詳細は明らかにしなかったあなたのサービスはありませんし、私はまだあなたのポストに直接コメントすることができませんが、あなたがこのの概要がチェックし、あなたがしていることを確認することですthis link

を試みるかもしれないもの適切な32/64ビットのinstallutil.exeを実行し、マージモジュールが問題を引き起こしていないことを確認してください。

おそらくあなたのサービスのより良い説明が役に立ちますか?サーバーとは対照的に、ローカルマシンにサービスが正常にインストールされていますか?

関連する問題