4

2つのWindowsサービスを含むプロジェクトがあります。これらのアイテムをインストールするためのProjectInstallerを作成しましたが、これは正常に機能します。しかし、質問があります。以下に定義されているコードを考えると、プロジェクトインストーラーは、serviceInstaller1にインストールするサービスとserviceInstaller2にインストールするサービスをどのように認識しますか?

それは単にServiceNameに基づいていますか?

[RunInstaller(true)]
public partial class ProjectInstaller : System.Configuration.Install.Installer
{
    private ServiceProcessInstaller process;
    private ServiceInstaller serviceInstaller1;
    private ServiceInstaller serviceInstaller2;
    public ProjectInstaller()
    {
        InitializeComponent();
        try
        {
            process = new ServiceProcessInstaller();
            process.Account = ServiceAccount.LocalSystem;
            serviceInstaller1 = new ServiceInstaller();
            serviceInstaller1.ServiceName = "xxx";
            serviceInstaller1.Description = "Does Something";
            serviceInstaller1.StartType = ServiceStartMode.Automatic;

            serviceInstaller2 = new ServiceInstaller();
            serviceInstaller2.ServiceName = "yyy";
            serviceInstaller2.Description = "Does something else";
            serviceInstaller2.StartType = ServiceStartMode.Automatic;
            Installers.Add(process);
            Installers.Add(serviceInstaller1);
            Installers.Add(serviceInstaller2);
        }
        catch (Exception ex)
        {
            throw new Exception("Failed", ex);
        }
    }
}
4

1 に答える 1

4

に基づいていServiceNameます。

インストーラーは名前をあまり気にしません。ほとんどの名前を指定できます。インストーラーは喜んでこの名前で Windows サービスを登録しますが、サービスを開始しようとすると失敗します。インストーラーで指定された とServiceName一致するアセンブリ。ServiceName

Error 1083: The executable program that this service is configured to run in does not implement the service.
于 2011-05-17T23:57:53.330 に答える