quartz.net-3.0 - Quartz.net:GetDefaultScheduler() 的类型
解决方案
你必须await
为结果。我想你没有在等待。
StdSchedulerFactory factory = new StdSchedulerFactory(props);
IScheduler scheduler = await factory.GetScheduler();
await scheduler.Start();
这是来自 Quartz 文档的完整示例。
private static async Task RunProgram()
{
try
{
// Grab the Scheduler instance from the Factory
NameValueCollection props = new NameValueCollection
{
{ "quartz.serializer.type", "binary" }
};
StdSchedulerFactory factory = new StdSchedulerFactory(props);
IScheduler scheduler = await factory.GetScheduler();
// and start it off
await scheduler.Start();
// some sleep to show what's happening
await Task.Delay(TimeSpan.FromSeconds(60));
// and last shut down the scheduler when you are ready to close your program
await scheduler.Shutdown();
}
catch (SchedulerException se)
{
await Console.Error.WriteLineAsync(se.ToString());
}
}
推荐阅读
- javascript - 3秒后调用函数更新'onclick'参数
- angular - 如何在 Angular 7 中手动清除 routeReuseStrategy?
- java - Spring集成在运行时添加路由
- android - 如何在 android 中获取 XML 响应字符串以及 Kotlin 数据模型?
- reactjs - TypeError:_mapboxGl.default.Map 不是构造函数
- python - Selenium/BeautifulSoup 中的 Python
- javascript - 您如何遍历数组并仅提取特定值的键:值?
- excel - 柯拉兹猜想。找到最小的 a_k
- ruby-on-rails - 是否可以在 rails 4.2 中使用神社 3.0?这样我们就可以立即更换回形针
- android - Firebase Android 莫名崩溃