'Quartz.Impl.StdSchedulerFactory'的类型初始值设定项引发了异常

时间:2011-11-03 15:43:04

标签: c# quartz-scheduler quartz.net typeinitializeexception

我非常密切关注Quartz.Net's tutorial上的说明,但在尝试调试项目时遇到了启动错误。

 The type initializer for 'Quartz.Impl.StdSchedulerFactory' threw an exception.

我在网上找不到任何帮助。这是配置问题吗?有谁知道我在哪里可以得到需要配置的简单列表?

(我正在使用Quartz.Net 2.0)

INNER EXCEPTION:{“无法从配置部分'common / logging'获取Common.Logging的配置。”}

3 个答案:

答案 0 :(得分:4)

您很可能不会引用所有必需的程序集,例如“Common.Logging.dll”。

<强>更新

构造函数失败,因为您的app.configweb.config不包含common\logging的部分。您的.config文件是否包含以下部分:

  <configSections>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
  </configSections>
  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
        <arg key="level" value="DEBUG" />
        <arg key="showLogName" value="true" />
        <arg key="showDataTime" value="true" />
        <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
      </factoryAdapter>
    </logging>
  </common>

答案 1 :(得分:0)

检查您是否在解决方案中添加了对Common.Logging.Log4Net dll的引用。

如果没有,您可以在Common.Logging.Log4Net中找到兼容的Quartz.NET-2.0.1\lib\2.0 dll:

Download Quartz.NET-2.0.1.zip (9.7 MB)

此外,您可能需要使用log4net版本1.2.10.0

答案 2 :(得分:0)

就我而言,它是Quartz.net的版本。

最初我使用的是最新版本的Quartz.net,并且出现了同样的错误。现在我正在使用:

  • Common.Logging 2.1.2.0
  • Common.Logging.Log4Net1211 2.1.0.0
  • log4net 1.2.11.0
  • Quartz 2.2.2.400