Working with TopShelf, I'm running into an error around “Topshelf.HostConfigurators.WindowsServiceDescription service has not been installed yet.”

ⅰ亾dé卋堺 提交于 2019-12-11 07:43:26

问题


Has anyone had experience with TopShelf when building Windows Services?

I keep running into this error when trying to start the service,

"Topshelf.HostConfigurators.WindowsServiceDescription service has not been installed yet."

The build, installer, installation, and all those steps are completed and the service appears in the services list in Windows Server, yet when I click on the service and attempt to start it, this exception is thrown. The full error message is shown below.

INFO 10:23:08 Starting up as a winservice application FATAL 10:23:08 The Topshelf.HostConfigurators.WindowsServiceDescription service has not been installed yet. Please run 'RIS.ModelGenerator.Scheduler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null install'. ERROR 10:23:08 The service exited abnormally with an exception Topshelf.Exceptions.ConfigurationException: The Topshelf.HostConfigurators.WindowsServiceDescription service has not been installed yet. Please run 'RIS.ModelGenerator.Scheduler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null install'. at Topshelf.Windows.WindowsServiceHost.Run() in d:\BuildAgent-01\work\799c08e77fef999d\src\Topshelf\OS\Windows\WindowsServiceHost.cs:line 56 at Topshelf.HostFactory.Run(Action`1 configure) in d:\BuildAgent-01\work\799c08e77fef999d\src\Topshelf\Config\HostFactory.cs:line 45


回答1:


The problem is most likely that you have spaces in your service name. For whatever reason, Topshelf 2.2.2.0 does properly search for services with a space in the name, even though the service may be installed with a space, i.e. "My Service". When TopShelf searches for the service to check if it's installed, it will only look for "My".

Here's a snippet you can use to view the services installed on your box:

using System;
using System.Linq;

public class Foo
{
    public static void Main()
    {
        foreach(var x in System.ServiceProcess.ServiceController.GetServices().OrderBy(x => x.ServiceName))
        {
            Console.WriteLine("Service Name: '{0}';, Display Name: '{1}'", x.ServiceName, x.DisplayName);
        }

        Console.ReadKey();
    }
}



回答2:


It appears, that I had a version that just doesn't really work (which appears to be the latest version). I had to roll back (via NuGet thanksfully) to a previous version, pre v2.0 in order to resolve my issue. It also appeared that the project I was working on was hooked into some pre v2.0 features/methods, thus the ensuing problem.

Thanks to Jeff Schumacher for the extra assist on this problem. Hopefully the TopShelf software is updated to not have these disparities in current versions.



来源:https://stackoverflow.com/questions/7351973/working-with-topshelf-im-running-into-an-error-around-topshelf-hostconfigurat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!