顶层给出错误序列包含多个元素
我正在尝试使用顶层架子将控制台应用程序托管为窗口服务,这里是代码:
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 more element"}
in最后一行
Runner.Host(cfg, args);
有人可以帮忙吗?
I am trying to host a console application as window service using top shelf here is the code :
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);
From command line i am running as :
ExeName install username password
I am getting an error {"Sequence contains more than one element"}
in last line
Runner.Host(cfg, args);
Can someone please help ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的是哪个版本的 Topshelf?
通过命令行的用户名和密码已经有一段时间无法使用了,如果您从 Chris 那里获取了最新的开发代码,他添加了此功能,位于 https://github.com/phatboyg/Topshelf/tree/develop 我认为它已经得到解决,否则只需将其设置在代码中以从 app.config 读取暂时。
What version of Topshelf are you using?
The username and password via the command line has not been working in a while, if you grab the latest development code from Chris, who added this feature, at https://github.com/phatboyg/Topshelf/tree/develop I think it has been addressed, otherwise just set it in the code to read from an app.config for the time being.