我想测试Quartz.NET 3.0 for .NET Core的SQL数据库功能。很遗憾,我无法正确配置StdSchedulerFactory
,我在调用StdSchedulerFactory.GetScheduler
时总是遇到以下异常:
System.ArgumentOutOfRangeException:
There is no metadata information for provider 'SqlServer-20'
Parameter name: providerName
at Quartz.Impl.AdoJobStore.Common.DbProvider.GetDbMetadata(String providerName)
at Quartz.Impl.AdoJobStore.Common.DbProvider..ctor(String dbProviderName, String connectionString)
at Quartz.Impl.StdSchedulerFactory.<Instantiate>d__66.MoveNext()
我已使用以下值配置工厂:
var configuration = new NameValueCollection
{
{ "quartz.jobStore.type", "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" },
{ "quartz.jobStore.driverDelegateType", "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" },
{ "quartz.jobStore.tablePrefix", "QRTZ_" },
{ "quartz.jobStore.dataSource", "default" },
{ "quartz.dataSource.default.connectionString", "Server=(localdb)\\mssqllocaldb;Database=QuartzTest;Trusted_Connection=True;MultipleActiveResultSets=true" },
{ "quartz.dataSource.default.provider", "SqlServer-20" },
{ "quartz.jobStore.useProperties", "true" },
{ "quartz.serializer.type", "json" }
};
var schedulerFactory = new StdSchedulerFactory(configuration);
如您所见,我目前的目标是LocalDB(v12.0.2000)。我也在SQL Server Express上检查了它 - 结果相同。
如何避免此异常?
tables_sqlServer.sql
脚本。答案 0 :(得分:6)
目前根据beta1的更新日志,提供商没有版本。因此,正确的SqlServer提供程序配置是:
["quartz.dataSource.sqlserver.provider"] = "SqlServer"
答案 1 :(得分:2)
我的一位朋友刚刚找到答案:根据this example on Github,您必须在.NET Core项目中使用SqlServer-41
而不是SqlServer-20
。
答案 2 :(得分:0)
View