0

我正在尝试使用顶层架子将控制台应用程序作为窗口服务托管,代码如下:

RunConfiguration cfg = RunnerConfigurator.New(x =>
{
   x.ConfigureService<Certegy>(s =>
   {
       s.Named("certegy");
       s.HowToBuildService(name => new Certegy());
       s.WhenStarted(tc => tc.Start());
       s.WhenStopped(tc => tc.Stop());
    });
    if (string.IsNullOrEmpty(args[1]))
    {
        x.RunAsLocalSystem();
        }
    else
    {
        x.RunAs(args[1], args[2]);
    }

    x.SetDescription("Certegy host to get the messages from the queue");
    x.SetDisplayName("Certegy Interface");
    x.SetServiceName("Certegy Interface");
});

   Runner.Host(cfg, args);

从命令行我运行为:

ExeName install username password 

{"Sequence contains more than one element"}在最后一行 收到错误

Runner.Host(cfg, args);

有人可以帮忙吗?

4

1 回答 1

0

您使用的是什么版本的 Topshelf?

通过命令行的用户名和密码已经有一段时间没有工作了,如果你从添加此功能的 Chris 那里获取最新的开发代码,我认为它在https://github.com/phatboyg/Topshelf/tree/develop已解决,否则只需在代码中将其设置为暂时从 app.config 读取。

于 2011-02-21T12:27:04.260 回答