问题
When installing af service through cmd.exe the installer requires interaction with the command prompt. Twice i have to press a key to get it to continue. This is a problem for me when I want to automate the install.
c:\>MyService.exe install
Configuration Result:
[Success] Name SFTP_Service
[Success] DisplayName SFTP Service
[Success] Description SFTP Service
[Success] ServiceName SFTP_Service
Topshelf v3.1.118.0, .NET Framework v4.0.30319.17929
Running a transacted installation.
Beginning the Install phase of the installation.
Installing SFTP Service service
At this point interaction is required
Installing service SFTP_Service...
Service SFTP_Service has been successfully installed.
Creating EventLog source SFTP_Service in log Application...
At this point interaction is required again
The Install phase completed successfully, and the Commit phase is beginning.
The Commit phase completed successfully.
The transacted install has completed.
c:\>
What can I do to make the installer continue?
回答1:
Facepalm!
This will happen if you have this in your HostFactory.Run()
x.BeforeInstall(() => Console.ReadKey());
x.AfterInstall(() => Console.ReadKey());
来源:https://stackoverflow.com/questions/19925979/topshelf-installer-requires-me-to-press-enter-twice-why