I just installed latest version of TS (4.0.3).
I copied sample code from documentation (see below) and am getting a number of compile time errors.
I believe the main issue is this error "Delegate 'System.Func<ConsoleApplicationServer.HangfireWebServer>' does not take 1 arguments"
public class Program
{
static void Main(string[] args)
{
HostFactory.Run(x =>
//Host host = HostFactory.New(x =>
{
x.Service<HangfireWebServer>(s =>
{
s.ConstructUsingName(name => new HangfireWebServer());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
x.RunAsLocalSystem();
x.SetDescription("A job queue manager built on top of Hangfire");
x.SetDisplayName("Job Queue (Hangfire)");
x.SetServiceName("JobQueue");
});
}
}
I believe the issue maybe that the ConstructUsingName method of the HostConfigurator is not longer available (deprecated??). If I comment out that line, I can compile the service, however I get a run time error which says:
Topshelf.HostFactory Error: 0 : The service terminated abnormally, Topshelf.HostConfigurationException: The service was not properly configured:
[Failure] Factory must not be null
at Topshelf.Configurators.ValidateConfigurationResult.CompileResults(IEnumerable`1 results)
at Topshelf.ServiceExtensions.<>c__DisplayClass7_0`1.<CreateServiceBuilderFactory>b__0(HostSettings x)
at Topshelf.HostConfigurators.HostConfiguratorImpl.CreateHost()
at Topshelf.HostFactory.New(Action`1 configureCallback)
at Topshelf.HostFactory.Run(Action`1 configureCallback)
I am not able to find any documentation which works. (Seems that the documentation here https://topshelf.readthedocs.io/en/latest/configuration/quickstart.html has not been updated (I noticed that the documentation says that it was tested with .Net 4.0 and it can only be installed with 4.5.2.
All help and sample code to work with 4.0.3 will be much appreciated.