简体   繁体   English

如何手动触发quartz.net服务器作业?

[英]How to manually trigger quartz.net server job?

I have Quartz.Net server running as a Windows Service. 我有作为Windows服务运行的Quartz.Net服务器。 I have custom job in DLL file and everything is working. 我在DLL文件中有自定义作业,并且一切正常。 Job is triggered at night, but sometimes I need to trigger this job manually from other applications running on the same machine. 作业是在晚上触发的,但有时我需要从同一计算机上运行的其他应用程序手动触发此作业。

How do you trigger it? 您如何触发它?

I think you can create an console application based on your service and in the Main add following code : 我认为您可以基于您的服务创建控制台应用程序,并在Main中添加以下代码:

static void Main(string[] args)
{
    TestService = new  TestService ();

    #if DEBUG
        TestService.StartWork();
    #else
        System.ServiceProcess.ServiceBase.Run(TestService ); 
    #endif
}

So you can create service based on this code and in order to trigger this job just to run this console app. 因此,您可以基于此代码创建服务,并为了触发此作业而仅运行此控制台应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM