[英]Topshelf service not running automatically after first execution completes
I have a service which should run after every time it finishes, But topshelf hosted windows service runs one time when I start it but never run again? 我有一项服务,该服务应在每次完成后运行,但是当我启动时,topshelf托管的Windows服务运行一次,但再也不会运行?
Do I need to configure something. 我需要配置一些东西吗?
My current configuration is 我当前的配置是
namespace RL.Reprice
{
class Program
{
public static void Main()
{
HostFactory.Run(serviceConfig =>
{
log4net.Config.XmlConfigurator.Configure();
serviceConfig.UseLog4Net();
serviceConfig.Service<RepriceBook>(serviceInstance =>
{
serviceInstance.ConstructUsing(
() => new RepriceBook());
serviceInstance.WhenStarted(
execute => execute.Start());
serviceInstance.WhenStopped(
execute => execute.Stop());
// serviceInstance.WhenPaused(
// execute => execute.Pause());
// serviceInstance.WhenContinued(
// execute => execute.Continue());
});
serviceConfig.EnableServiceRecovery(recoveryOption =>
{
recoveryOption.RestartService(2);
});
serviceConfig.SetServiceName("RepriceService");
serviceConfig.SetDisplayName("Reprice Book");
serviceConfig.SetDescription("This is Repricer");
serviceConfig.StartAutomatically();
});
}
}
}
使用Quartz.Net重复运行任务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.