quartz.net 使用总结

.net中使用第三方dll一定要注意版本问题:网上很多代码都是对的,你执行不了,有时候就是dll版本问题

粘个试过可用的供大家参考:

app.config:
<?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>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1211">
        <arg key="configType" value="FILE-WATCH" />
        <arg key="configFile" value="~/systemconfig/log4net.xml" />
        <arg key="level" value="ALL" />
      </factoryAdapter>
    </logging>
  </common>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup>

</configuration>

packages.config(可选。项目大时会很有用):

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Common.Logging" version="2.1.2" targetFramework="net40" />
  <package id="Common.Logging.Log4Net1211" version="2.1.2" targetFramework="net40" />
  <package id="log4net" version="2.0.0" targetFramework="net40" />
  <package id="TopShelf" version="3.1.0" targetFramework="net40" />
</packages>

quartz.config

# You can configure your scheduler in either <quartz> configuration section
# or in quartz properties file
# Configuration section has precedence

quartz.scheduler.instanceName = SurferSMSScheduler

# configure thread pool info
quartz.threadPool.type = Quartz.Simpl.SimpleThreadPool, Quartz
quartz.threadPool.threadCount = 10
quartz.threadPool.threadPriority =Normal

# job initialization plugin handles our xml reading, without it defaults are used
quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz
quartz.plugin.xml.fileNames = ~/systemconfig/quartz_jobs.xml

# job store
quartz.jobStore.misfireThreshold =60000
quartz.jobStore.type = Quartz.Simpl.RAMJobStore, Quartz

quartz_jobs.xml   log4net.xml这两个网上很多,基本都对。就不粘了

链接分享:

http://www.soaspx.com/dotnet/csharp/csharp_20110620_7737.html(这个要注意dll版本)

http://www.cnblogs.com/wucg/archive/2010/07/26/1784924.html(这个要注意dll版本)

http://blog.cfxixi.com/post/2012/11/05/%E8%A7%A3%E5%86%B3net-Mvc3-Unable-to-create-type-CommonLoggingLog4NetLog4NetLoggerFactoryAdapter-CommonLoggingLog4Net%E9%97%AE%E9%A2%98.aspx

http://stackoverflow.com/questions/11368267/failed-obtaining-configuration-for-common-logging-from-configuration-section-co(就是看这篇才解决问题)

http://www.zhaodll.com/

原文地址:https://www.cnblogs.com/softidea/p/3108224.html