Per installare un servizio in configurazione Utente anzichè Local Service (o Local System) è necessario modificare la proprietà Account della ServiceProcessInstaller1 uguale a User e impostare Username e Password in ProjectInstaller.Designer.vb come quelle dell'utente che si vuole configurare.
Fondamentale: l'Username deve essere del tipo: NomeServer\Username o Dominio\Username
Per avviare il servizio al termine dell'installazione gestire la AfterInstall della ProjectInstaller (da CodeBehind)
Private Sub ProjectInstaller_AfterInstall(ByVal sender As Object, ByVal e As System.Configuration.Install.InstallEventArgs) Handles Me.AfterInstall
Dim timeout As TimeSpan = TimeSpan.FromSeconds(30)
Dim s As New ServiceProcess.ServiceController("MegaPrintServer")
s.Start()
s.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running, timeout)
End Sub
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento