Topshelf异常 [英] Topshelf exception

查看:731
本文介绍了Topshelf异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 topshelf ,当我尝试使用 - 时遇到此异常, i选项安装为服务...请帮助我..

I'm using topshelf and I'm getting this exception when I try to use the "-i" option to install as a service...please help me..


无法投射类型为Magnum.CommandLineParser.SwitchElement '键入Magnum.CommandLineParser.IArgumentElement。

Unable to cast object of type 'Magnum.CommandLineParser.SwitchElement' to type 'Magnum.CommandLineParser.IArgumentElement'.

此函数中出现异常

static void Set(TopshelfArguments args, 
                IEnumerable<ICommandLineElement> commandLineElements)
{
    var command = commandLineElements
        .Take(1)
        .Select(x => (IArgumentElement) x) //EXCEPTION BREAKS ON THIS LINE
        .Select(x => x.Id)
        .DefaultIfEmpty("commandline")
        .SingleOrDefault();

    args.Command = command;
    //leftovers
    args.CommandArgs = commandLineElements.Skip(1).ToList();
}

感谢

推荐答案

我们使用TopShelf作为服务安装的方式是

The way we use TopShelf to install as a service is

program.exe service install

我相信这是RC代码支持的唯一方法。您可以通过

I believe this is the only way it's supported in the RC code. You can uninstall via

program.exe service uninstall

这篇关于Topshelf异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆