2012-09-11 6 views
18

Windowsサービスをインストールしようとしています。 \ WINDOWS \ microsoft.net \ Framework64 \ v4.0.30319 C InstallUtil.exe \:\ fooという\ MyAssembly.exeinstallutilは正常に完了しましたが、サービスはインストールされていません

私はすべてのフェーズ(コミット、インストール)が正常に完了した素敵なメッセージを取得し、Cを実行している

(私はサービスの資格情報を入力するように求めされません)

その後私は、サービスコンソールでサービスが表示されません。インストールログには何も役立たない。

解決策は64ビットボックス上に構築されており、私は64ビットマシンにサービスをインストールしようとしています。しかし、私はソリューションのプロパティのオプションとして64bitを見ていない。私は[プラットフォーム]ノードの "x64"を選択するために、すべてのcsprojファイルを手動で編集しました..

私はVisual Studioからサービスを実行できます。

[RunInstaller(true)] 
public partial class Installer : System.Configuration.Install.Installer 
{ 
    public Installer() { 
     InitializeComponent(); 
    } 
} 

これは、Visual Studioが提供するデフォルトのインストーラですinstaller.cs

+0

私はあなたのタイトルを編集しました。 「[質問には「タイトル内に「タグ」を含める必要がありますか」(http://meta.stackexchange.com/questions/19190/)」を参照してください。コンセンサスは「いいえ、そうすべきではありません」です。また、それがインストールの問題なら、これはWCFとは関係がない可能性が高いので、そのタグを削除しました。 –

+0

申し訳ありません間違った言葉の選択。インストールスクリプト! – madhairsilence

+0

madhairsilence ..インストーラは何を求めていたのですか? –

答えて

24

インストーラオブジェクトにインストーラオブジェクトを追加する必要があります。例hereは、Windowsサービスをインストールするためのものです。何かのように

[RunInstaller(true)] 
public class Installer : System.Configuration.Install.Installer 
{ 
    private ServiceInstaller serviceInstaller; 
    private ServiceProcessInstaller processInstaller; 

    public Installer() 
    { 
     // Instantiate installers for process and services. 
     processInstaller = new ServiceProcessInstaller(); 
     serviceInstaller = new ServiceInstaller(); 

     // The services run under the system account. 
     processInstaller.Account = ServiceAccount.LocalSystem; 

     // The services are started manually. 
     serviceInstaller.StartType = ServiceStartMode.Manual; 

     // ServiceName must equal those on ServiceBase derived classes. 
     serviceInstaller.ServiceName = "Hello-World Service 1"; 

     // Add installers to collection. Order is not important. 
     Installers.Add(serviceInstaller); 
     Installers.Add(processInstaller); 
    } 
} 
関連する問題