I've created a C# console application and am attempting to use TopShelf to assist in deploying the application as a service. In my Main method I have the following code:
HostFactory.New(x =>
{
x.Service<BusinessLogic>(s =>
{
s.ConstructUsing(name => new BusinessLogic());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.StartAutomatically();
x.SetDescription("Business Logic");
x.SetDisplayName("BusinessLogic");
x.SetServiceName("BusinessLogic");
});
After I build, I open an administrator command prompt and enter "BusinessLogic.exe install" and get the following output:
Configuration Result:
[Success] Name BusinessLogic
[Success] Description Business Logic
[Success] ServiceName BusinessLogic
Topshelf v4.0.0.0, .NET Framework v4.0.30319.42000
I didn't realize it at first, but based on various Google searches I now see that this output is missing the installation portion of the "install" process.
If I enter "BusinessLogic.exe help" I get the exact same output.
The service is obviously not installed. Any help is appreciated.
Rob