';的类型初始值设定项;Quartz.Impl.StdSchedulerFactory;在Quartz.net中引

本文关键字:Quartz Impl StdSchedulerFactory 中引 net 类型 | 更新日期: 2023-09-27 18:26:09

我正在使用Quartz.net进行调度。我一运行代码,它就会在下面的行中抛出愚蠢的异常。

ISchedulerFactory obSchedulerFactory = new StdSchedulerFactory();

例外情况是:

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

我不能理解这个问题。

';的类型初始值设定项;Quartz.Impl.StdSchedulerFactory;在Quartz.net中引

您很可能没有引用所有必需的程序集,例如Common.Logging.dll.

或者StdSchedulerFactory的构造函数失败,因为app.config或web.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>

错误可能与app.config文件有关。尝试删除所有空行。