通过cmd.exe安装af服务时,安装程序需要与命令提示符进行交互。两次我必须按一个键让它继续。 当我想自动安装时,这对我来说是一个问题。
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
此时需要互动
Installing service SFTP_Service...
Service SFTP_Service has been successfully installed.
Creating EventLog source SFTP_Service in log Application...
此时需要再次进行互动
The Install phase completed successfully, and the Commit phase is beginning.
The Commit phase completed successfully.
The transacted install has completed.
c:\>
如何让安装程序继续?
答案 0 :(得分:3)
捂脸!
如果你在HostFactory.Run()
中有这个,就会发生这种情况x.BeforeInstall(() => Console.ReadKey());
x.AfterInstall(() => Console.ReadKey());