C#Quartz.net调度程序作业作为windows服务,虽然windows服务正在运行,但未执行

C#Quartz.net调度程序作业作为windows服务,虽然windows服务正在运行,但未执行,c#,quartz-scheduler,quartz.net,topshelf,C#,Quartz Scheduler,Quartz.net,Topshelf,我不熟悉Topshelf和Quartz.net 我想使用c#quartz.net作为windows服务运行调度程序作业。我已经创建了一个windows服务,并进行了所有必要的设置以调用调度程序作业。我没有收到任何错误,窗口服务已成功启动。但是,当我将调试点放在调度程序作业中时,即使在我设置的时间已经到了,它也不会被执行 Program.cs internal class Program { private static readonly IUnityContainer Container

我不熟悉Topshelf和Quartz.net

我想使用c#quartz.net作为windows服务运行调度程序作业。我已经创建了一个windows服务,并进行了所有必要的设置以调用调度程序作业。我没有收到任何错误,窗口服务已成功启动。但是,当我将调试点放在调度程序作业中时,即使在我设置的时间已经到了,它也不会被执行

Program.cs

internal class Program
{
    private static readonly IUnityContainer Container = UnityConfig.GetConfiguredContainer();
    static void Main(string[] args)
    {
        HostFactory.Run(serviceConfig =>
        {
            serviceConfig.Service<ISchedulerService>(serviceInstance =>
            {
                serviceInstance.ConstructUsing(name => Container.Resolve<ISchedulerService>());
                serviceInstance.WhenStarted(execute => execute.Start());
                serviceInstance.WhenStopped(execute => execute.Stop());
            });
            serviceConfig.RunAsLocalSystem();
            serviceConfig.SetDescription("Scheduler");
            serviceConfig.SetDisplayName("Scheduler");
            serviceConfig.SetServiceName("Scheduler");

            serviceConfig.StartAutomatically();
        });
    }
} 
谁能帮帮我我做错了什么


谢谢

我也遇到了类似的问题。我有一个测试项目可以运行,而我的实际项目却无法运行

问题似乎与服务名称的长度和/或名称中点的使用有关


不过,我在Quatrz源代码中没有找到任何东西来证实这一点。根据我的本地测试,工作服务和非工作服务之间的唯一区别是服务名称

我也遇到了类似的问题,发现没有默认构造函数才是问题所在

比如说:

public class ExportPrsLiveReportJob : IJob
{
    private readonly ISomeService _service;

    public ExportPrsLiveReportJob(ILogProvider logProvider, ISomeService service)
    {
        _service = service;
    }

    public ExportPrsLiveReportJob() : this(<however your system does dependency resolution for ILogProvider and ISomeService>){

    }

    public async void Execute(IJobExecutionContext context)
    {
        var data = await _service.Get();
    }
}
public类exportPRSLiverReportJob:IJob
{
私人只读服务(U服务);;
公共ExportPRSLiverReportJob(ILogProvider日志提供程序,ISomeService服务)
{
_服务=服务;
}
public exportPRSLiverReportJob():this(){
}
公共异步void Execute(IJobExecutionContext上下文)
{
var data=await_service.Get();
}
}

您有没有找到解决方案?我也有同样的问题。@RemotecUk,不,我没有得到任何解决方案。
public class MyJob : IJob
{
    private readonly ISomeService _service;

    public ExportPrsLiveReportJob(ILogProvider logProvider, ISomeService service)
    {
        _service = service;
    }

    public async void Execute(IJobExecutionContext context)
    {
        var data = await _service.Get();
    }
}
public class ExportPrsLiveReportJob : IJob
{
    private readonly ISomeService _service;

    public ExportPrsLiveReportJob(ILogProvider logProvider, ISomeService service)
    {
        _service = service;
    }

    public ExportPrsLiveReportJob() : this(<however your system does dependency resolution for ILogProvider and ISomeService>){

    }

    public async void Execute(IJobExecutionContext context)
    {
        var data = await _service.Get();
    }
}