2009-10-16 6 views
31

私が書いたサービスを展開しようとしています。 InstallLogファイルは次のとおりです。自己開発Windowsサービスのインストール

Installing assembly 'c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe'. 
Affected parameters are: 
    logtoconsole = 
    assemblypath = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe 
    logfile = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.InstallLog 
Installing service TweetLinkService... 
Creating EventLog source TweetLinkService in log Application... 
Rolling back assembly 'c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe'. 
Affected parameters are: 
    logtoconsole = 
    assemblypath = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe 
    logfile = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.InstallLog 
Restoring event log to previous state for source TweetLinkService. 
An exception occurred during the Rollback phase of the System.Diagnostics.EventLogInstaller installer. 
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security. 
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. 

ご覧のとおり、動作していません。私はどのように進むべきか分かりませんし、BingとGoogleで壁に突っ込んできました。私はserviceProcessInstaller1のLocalSystemにAccountを設定しました。コードはうまくコンパイルされますが、今はそのアイデアを実行したいと思います...アイデアは何ですか?私は私のボックスに管理者、と私は、コマンドを実行しています:

ます。installutil TweetLinkQueue.exe

VS2008管理コンソールから。エントリポイントで更新

public TweetLinkService() 
{ 
    InitializeComponent(); 

    if (!EventLog.SourceExists("TweetLinkQueue")) 
    { 
     EventLog.CreateEventSource("TweetLinkQueue", "Log"); 

     TweetLinksLog.Source = "TweetLinkQueue"; 
     TweetLinksLog.Log = "Log"; 

     TweetLinksLog.WriteEntry("Log Created!"); 
    } 
} 

/ShowCallStackオプションで更新

コールスタック

An exception occurred during the Install phase. 
System.Security.SecurityException: The source was not found, but some or all eve 
nt logs could not be searched. Inaccessible logs: Security. 
    at System.Diagnostics.EventLog.FindSourceRegistration(String source, String m 
achineName, Boolean readOnly) 
    at System.Diagnostics.EventLog.SourceExists(String source, String machineName 
) 
    at System.Diagnostics.EventLogInstaller.Install(IDictionary stateSaver) 
    at System.Configuration.Install.Installer.Install(IDictionary stateSaver) 
    at System.ServiceProcess.ServiceInstaller.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 savedSt 
ate) 
    at System.Configuration.Install.Installer.Install(IDictionary stateSaver) 
    at System.Configuration.Install.TransactedInstaller.Install(IDictionary saved 
State) 

、ここでは、コンストラクタで

namespace TweetLinkQueue 
{ 
    static class Program 
    { 
     /// <summary> 
     /// The main entry point for the application. 
     /// </summary> 
     static void Main() 
     { 
      ServiceBase[] ServicesToRun; 
      ServicesToRun = new ServiceBase[] 
      { 
       new TweetLinkService() 
      }; 
      ServiceBase.Run(ServicesToRun); 
     } 
    } 
} 
+0

/ShowCallStackオプションを指定してinstallutilを実行すると、追加情報はありますか? – itowlson

+0

ログファイル情報は上記の質問にあります。 –

+0

サービスをインストールしようとしているユーザーは、セキュリティイベントログに書き込む権限を持っていますか? – Oded

答えて

13

アイムないあなたの特定の問題が何であるか確かめてください。 EventLogソースの作成中に問題が発生したように見えます。その部分を正しく実行したことを再度確認してください。あなたはステップバイステップhereを参照することができます。 編集:手順9で具体的に確認してください。アプリケーションに固有のものではなく、アプリケーションログを乱用しているため、問題が発生している可能性があります。

InstallUtilの使用には何も問題はありませんが、あなたのサービスを外国のマシンにインストールする必要がある場合、InstallUtilはそこにいるとは限りません。この手順に従い、InstallUtilを必要とせずに、Windowsサービスをインストール/アンインストールすることができます。これらの手順については、hereを参照してください。

2

LocalSystemアカウントには通常、セキュリティイベントログを読み取る権限(またはその問題のイベントソースを作成する権限)がありません。

最も簡単で安全な解決策は、イベントソースインストールプログラムを作成して、これを実行する任意のマシン上で独自の管理レベルの資格情報で実行できるようにすることです。これを簡単なテストとして試してみる価値はあるかもしれません。あなたのアカウントにこれを行う権限があるかどうかを確認するだけです。

class Program { 
    static void Main(string[] args) { 
     EventLog.CreateEventSource("TestSource", "Application"); 
    } 
} 

実行すると成功しますか?アプリケーションログのプロパティを確認し、[フィルタ]タブの[イベントソース]を参照して確認できます。サービスがとにかくインストールする必要があるため

代わりに、あなたは(misnamedされている - それは本当に必要なEventLogsを作成する「EventSourceInstaller」です)EventLogInstaller追加することができます代わりに、サービスのコンストラクタでEventLog.CreateEventSourceを使用しての組み立てに。

+0

はい。これを行う方法の例については、ステップ9の次のコード(http://stackoverflow.com/questions/593454/easiest-language-to-create-a-windows-service/593803#593803)を参照してください。 –

+0

これは間違いなく良い例です。 –

109

私はちょうどこの問題を抱えていました。私は管理者としてビジュアルスタジオコマンドプロンプトを実行していないためでした。

+8

これは答えとしてマークする必要があります。 –

+0

これは私のマシン上では稼働していても、稼動していない理由を説明しています – TruthOf42

+2

サービスをインストールするためのBATファイルを作成しましたが、BATファイルを右クリックして "管理者として実行"機能していませんでした。それを動作させるためには、BATファイルの代わりにcommannd行プロンプト(cmd.exe)を「管理者として実行する」。それから、私は手動でインストールし、それは働いた。 –

8

この問題を解決するには、Visual Studio 2008のコマンドプロンプトを右クリックし、管理者として実行するをクリックし、installutil C:\ mcWebService \ bin \ Debug \ mcWebServiceのようなコマンドを実行します。exe を入力すると、正常にメッセージが表示されます。 これがあなたの解決策を解決することを願っています。

0

私の問題は、資格情報を入力するウィンドウがポップアップしていて、ドメインなしでユーザー名を入力していたことです。一度私はドメイン\ユーザー名を入力しても問題ありませんでした。

関連する問題