Re: [topshelf-discuss] Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation.

524 views
Skip to first unread message

Dru Sellers

unread,
Jul 1, 2015, 11:27:04 PM7/1/15
to topshelf...@googlegroups.com
Have you tried running the app to see why its opening a dialog box? There is a lot of System calls going on in there as well.

On Wed, Jul 1, 2015 at 3:58 PM, Scott McFadden <scott.kenda...@gmail.com> wrote:
I have an Octopus / powershell script that attempts to install my topshelf service on a given box.  I get an error that a dialog box was popped in a non-UI app (Octopus tentacle).

Unhandled Exception: System.InvalidOperationException: The installation failed, and the rollback has been performed. ---> System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
Error    15:51:06
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
Error    15:51:06
   at System.Windows.Forms.Form.ShowDialog()
Error    15:51:06
   at System.ServiceProcess.ServiceProcessInstaller.GetLoginInfo()
Error    15:51:06
   at System.ServiceProcess.ServiceProcessInstaller.get_Account()
Error    15:51:06
   at System.ServiceProcess.ServiceInstaller.Install(IDictionary stateSaver)
Error    15:51:06
   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
Error    15:51:06
   at Topshelf.Runtime.Windows.HostInstaller.Install(IDictionary stateSaver)
Error    15:51:06
   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
Error    15:51:06
   at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
Error    15:51:06
   --- End of inner exception stack trace ---
Error    15:51:06
   at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
Error    15:51:06
   at Topshelf.Runtime.Windows.HostServiceInstaller.InstallService(Action`1 beforeInstall, Action`1 afterInstall, Action`1 beforeRollback, Action`1 afterRollback)
Error    15:51:06
   at Topshelf.Runtime.Windows.WindowsHostEnvironment.InstallService(InstallHostSettings settings, Action beforeInstall, Action afterInstall, Action beforeRollback, Action afterRollback)
Error    15:51:06
   at Topshelf.Hosts.InstallHost.Run()
Error    15:51:06
   at TopShelf.HostRunner.TopShelfHostRunner.Run(IWindsorContainer container, String serviceName, String serviceDisplayName, String serviceDescription, Action`1 hostConfigAction) i

Here is the relevant piece of my powershell script:


# try and install / update the service by name
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue

$fullPath = Resolve-Path $ServiceExecutable

Write-Host "fullPath = $fullPath"

if (! $service)
{
    #TODO: consider adding support for user/password. See http://topshelf.readthedocs.org/en/latest/overview/commandline.html
    Write-Host "The service will be installed."

& "$fullPath" "install" | Write-Host
}
else
{
    Write-Host "The service will be stopped and reconfigured."

& "$fullPath" "stop" | Write-Host
    & "sc.exe" config $service.Name binPath= $fullPath start= auto | Write-Host
}

How do you prevent the topshelf installation from popping a dialog box?


thanks

scott


--
You received this message because you are subscribed to the Google Groups "topshelf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topshelf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Patterson

unread,
Jul 2, 2015, 2:12:34 PM7/2/15
to topshelf...@googlegroups.com
Sounds like your service is using the interactive prompt to enter the service username/password. This is only done when the following two approaches are used:

--interactive
This runs the service installer which prompts for the credentials.
-or-
RunAsPrompt()
This is specified in the host configurator, and tells Topshelf to prompt the interactive session for credentials.

Reply all
Reply to author
Forward
0 new messages