1

Trying to get quartz to log in ms sql server but getting error in web config file.

</configSections>


<quartz>
<add key="quartz.scheduler.instanceName" value="SchedulingPOC"/>
<add key="quartz.scheduler.instanceId" value="SchedulingPOC"/>

<!-- Configure Thread Pool -->
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />

<!-- Configure Job Store -->
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />

<add key="quartz.dataSource.default.connectionString" value="Server=.\SQLExpress;Database=testDB;Trusted_Connection=True;"/>

<add key="quartz.dataSource.default.provider" value="SqlServer-20" />
</quartz>

Running the application in debug mode of Visual Studio Express for web.

Error message:

Detailed Error Information:

Module IIS Web Core

Notification Unknown

Handler Not yet determined

Error Code 0x80070032

Config Error The configuration section 'quartz' cannot be read because it is missing a section declaration

Config File \?\C:\Users\Anbbb\Desktop\TheProject.Web\web.config

<quartz>
 24:     <add key="quartz.scheduler.instanceName" value="SchedulingPOC"/>
MikeAlike234
  • 759
  • 2
  • 12
  • 29
  • I have used Quartz.net a couple of times but I don't see why you have the Quartz config in the Web.config. Surely, it should be in an App.config in a console application project? – Seany84 Mar 12 '14 at 15:52
  • Its in web.config because its a Asp.net mvc Project, and i want quarz to keep track of whats been done and not in a database instead of ram. – MikeAlike234 Mar 12 '14 at 16:37
  • Have you followed the suggestions here: http://stackoverflow.com/a/6504528/550198 – Seany84 Mar 12 '14 at 16:50
  • I have created the tables and tried to put the configuration in web.config (witch generate error), but it seams like it should be in app.config. I dont know how to make this work with an Asp.net mvc application. – MikeAlike234 Mar 12 '14 at 17:43

1 Answers1

1

//The configuration section 'quartz' cannot be read because it is missing a section declaration//

Do you have the "section name" defined in "configSections" ??

<configSections>
    <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />

    <sectionGroup name="common">
        <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>

</configSections>

PS I have a "working" AdoStore example at this post:

Connecting Quartz to MS Sql Server

(One of the answers, not the question)

=======

EDIT

Here is my complete and fully working Quart.Net config, using a SqlServer database.

It ~~assumes~~ you have already created the database.

<?xml version="1.0" encoding="utf-8"?>
<configuration>


    <configSections>
        <section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <sectionGroup name="common">
            <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
        </sectionGroup>

    </configSections>


<quartz>

    <add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzSchedulerFromConfigFileSqlServer"/>
    <add key="quartz.scheduler.instanceId" value="instance_one"/>
    <add key="quartz.threadPool.threadCount" value="10"/>
    <add key="quartz.threadPool.threadPriority" value="Normal"/>

    <!-- 
    org.quartz.scheduler.idleWaitTime
    Is the amount of time in milliseconds that the scheduler will wait before re-queries for available triggers when the scheduler is otherwise idle. Normally you should not have to 'tune' this parameter, unless you're using XA transactions, and are having problems with delayed firings of triggers that should fire immediately.
    It defaults to every 30 seconds until it finds a trigger. Once it finds any triggers, it gets the time of the next trigger to fire and stops checking until then, unless a trigger changes.   -->
    <add key="quartz.scheduler.idleWaitTime" value ="5000"/>

    <!-- Misfire : see http://nurkiewicz.blogspot.com/2012/04/quartz-scheduler-misfire-instructions.html  -->
    <add key="quartz.jobStore.misfireThreshold" value="60000"/>
    <add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
    <add key="quartz.jobStore.tablePrefix" value="QRTZ_"/>
    <add key="quartz.jobStore.clustered" value="false"/>
    <add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>


    <add key="quartz.jobStore.dataSource" value="MySqlServerFullVersion"/>



    <!-- connectionStringName -->
    <!-- "true" below will result in Couldn't store job: JobDataMap values must be Strings when the 'useProperties' property is set.  Key of offending value: myFloatValue 
            exception.  -->
    <!-- <add key="quartz.jobStore.useProperties" value="true"/>  -->
    <add key="quartz.jobStore.useProperties" value="false"/>

    <add key="quartz.dataSource.MySqlServerFullVersion.connectionString" value="Server=MyServer\MyInstance;Database=QuartzDB;Trusted_Connection=True;Application Name='quartz_config';"/>
    <add key="quartz.dataSource.MySqlServerFullVersion.provider" value="SqlServer-20"/>





</quartz>   


</configuration>

This code should work....

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

You must change your connection string to an EXISTING database.....that is the Quartz database.....creating using the scripts provided in one of the downloadable projects.

Like this maybe:

https://subversion.assembla.com/svn/pms_michael/database/tables/tables_sqlServer.sql

Community
  • 1
  • 1
granadaCoder
  • 26,328
  • 10
  • 113
  • 146
  • Don't i have to set this properties in the code somewhere like in the constructor of StdSchedulerFactory? – MikeAlike234 Mar 12 '14 at 19:09
  • The settings are pretty much NamedValuePairs. Most of the time, you grab them from the .config file. Or you can code them up. Or you can mix them. See my answer here. http://stackoverflow.com/questions/22078761/configure-quartz-net-through-a-mixture-of-config-file-and-constructor – granadaCoder Mar 12 '14 at 19:17
  • I tried with namedValuePairs but getting errors: http://stackoverflow.com/questions/22361439/quartz-net-error-when-running-job-with-adostore – MikeAlike234 Mar 12 '14 at 19:20
  • Do you want the end result to be .config files or "code 'em up" ? – granadaCoder Mar 12 '14 at 19:37
  • I posted a complete .config file. – granadaCoder Mar 12 '14 at 20:05
  • Thanks! What am i suppoed to do with NameValueCollection config after that? Set it in StdSchedulerFactory? – MikeAlike234 Mar 12 '14 at 21:09
  • Im using Ms Sql server, so this probably wont work MySqlServerFullVersion. What type of application has this worded for? – MikeAlike234 Mar 12 '14 at 21:16
  • "MySqlServerFullVersion" is just a friendly name. You can call it "snoopy" if you rename it in every place consistently. If you got the NamedValuedPairs correctly now, you should be able to use generic samples now. – granadaCoder Mar 12 '14 at 21:33
  • You original question is "error in the web.config". If you have the named value pairs showing up in your code (via a Watch),,,then you've gotten this question answered. I'd "Mark It As Answer" and ask a new question. – granadaCoder Mar 12 '14 at 21:35