Windowsサービスのインストール中に(クラスMyServiceInstaller:Installer、およびServiceInstallerとServiceProcessInstallerを使用)、ユーザーが誤って入力した場合に、インストーラーにユーザーアカウント情報の再入力を強制する方法があります。
間違った情報が与えられると、インストールは間違ったユーザー名またはパスワードを示すエラー1001メッセージをスローし、インストールは失敗します。ユーザーが正しくなるまで、または資格情報の入力プロンプトをキャンセルするまで、ユーザーに再度プロンプトを表示したいと思います。
OnBeforeRollbackをオーバーライドして、再試行するように指示できますか?
private ServiceInstaller _ServiceInstaller;
private ServiceProcessInstaller _ProcessInstaller;
public GBServiceInstaller()
{
InitializeComponent();
_ServiceInstaller = new ServiceInstaller();
_ProcessInstaller = new ServiceProcessInstaller();
_ServiceInstaller.ServiceName = MyService.SERVICENAME;
_ServiceInstaller.Description = MyService.SERVICEDESCRIPTION;
_ServiceInstaller.StartType = ServiceStartMode.Manual;
Installers.Add(_ServiceInstaller);
Installers.Add(_ProcessInstaller);