Web 配置文件中的 Quartz.net 错误 [英] Quartz.net error in web config file

查看:61
本文介绍了Web 配置文件中的 Quartz.net 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图让quartz登录ms sql server,但是web配置文件出错.

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>

在 Visual Studio Express for web 的调试模式下运行应用程序.

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

错误信息:

详细错误信息:

模块 IIS Web 核心

Module IIS Web Core

通知未知

处理者尚未确定

错误代码 0x80070032

Error Code 0x80070032

配置错误无法读取配置节quartz",因为它缺少节声明

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

配置文件\?\C:\Users\Anbbb\Desktop\TheProject.Web\web.config

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

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

推荐答案

//无法读取配置节'quartz',因为它缺少节声明//

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

您是否在configSections"中定义了部分名称"??

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>

附注我在这篇文章中有一个工作"的 AdoStore 示例:

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

将 Quartz 连接到 MS Sql Server

(答案之一,不是问题)

(One of the answers, not the question)

========

编辑

这是我使用 SqlServer 数据库的完整且完全有效的 Quart.Net 配置.

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");

您必须将连接字符串更改为现有数据库.....即 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.

可能是这样:

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

这篇关于Web 配置文件中的 Quartz.net 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆