Quartz.net error in web config file

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"/>
quartz-scheduler
quartz.net
asked on Stack Overflow Mar 12, 2014 by MikeAlike234

1 Answer

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

answered on Stack Overflow Mar 12, 2014 by granadaCoder • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0