0

I'm new to running Quartz v3.5.0 on .NET framework 4.8 as a Windows service in an Autofac IoC. I had it working just fine with a RAMJobStore. But now that I created a QuartzData database (as prescribed) in MS Sql Server on my localhost, I seem to be missing something.

I keep getting a Quartz.SchedulerException: 'Could not Initialize DataSource: default' on my .GetScheduler() call, due to an ArgumentOutOfRangeException: There is no metadata information for provider 'SqlServer-20' Parameter name: providerName.

My App.config (UPDATED for a better connection string but the problem still exists)

<quartz>
    <add key="quartz.scheduler.instanceName" value="DefaultQuartzScheduler" />
    <add key="quartz.scheduler.instanceId" value="instance_one" />
    <add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
    <add key="quartz.threadPool.threadCount" value="5" />
    
    <add key="quartz.jobStore.misfireThreshold" value="60000" />
    <add key="quartz.serializer.type" value="json" />
    <add key="quartz.jobStore.clustered" value="false" />
    <!--<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz"/>
    -->
    
    <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
    <add key="quartz.jobStore.useProperties" value="true" />
      <add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
    
    <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz" />
    <add key="quartz.jobStore.dataSource" value="default" />
    <add key="quartz.dataSource.default.connectionString" value="Server=localhost;Database=QuartzData;Uid=XXX;Pwd=XXX" />
    <add key="quartz.dataSource.default.provider" value="SqlServer-20" />
</quartz>

My Program.cs

        var config = (NameValueCollection)ConfigurationManager.GetSection("quartz");

        ISchedulerFactory schedulerFactory = new StdSchedulerFactory(config);
        IScheduler Scheduler = schedulerFactory.GetScheduler().GetAwaiter().GetResult();

Thanks in advance for your help.

  • Which authentication method do you need to use? `Trusted_Connection=True;` uses Windows Login authentication (using the Windows or Active Directory account token of the running process). `Uid=XXX;Pwd=XXX` uses SQL Login authentication (a username and password created inside SQL Server, not linked to a Windows or Active Directory account). You can't mix the two authentication methods like that, choose one only. – AlwaysLearning Oct 23 '22 at 21:11
  • Oh! Geeze, thank you--that makes sense. The UserID in my connection string is Sql Server Authentication. – RoxSeibert Oct 23 '22 at 21:24
  • Updated my post... I changed the connection string as advised, but I'm still get the same error. :( – RoxSeibert Oct 23 '22 at 21:51
  • Where does `` come from? If it's referring to an IDbConnection-related provider I would expect this to be `System.Data.SqlClient` on .NET Framework or `Microsoft.Data.SqlClient` on .NET Core/6+. – AlwaysLearning Oct 23 '22 at 23:21

1 Answers1

0

The resolution to this problem was to set the properties on my app.config to always copy to output directory.

I had a bad connection string early on. And that got stuck in my bin because my revised app.config settings weren't overwriting the old settings.