Quartz.net和Common.Logging - 使用log4net的
-
19-09-2019 - |
题
我是Windows服务中使用Quartz.net。 目前,该触发器在不触发 - 我想使用日志,找出原因
我已经编辑我的配置文件为Windows服务:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<appSettings>
<!--specific win service settings here-->
</appSettings>
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
<arg key="configType" value="INLINE"/>
<arg key="configFile" value="c:\sched.log"/>
<arg key="level" value="INFO" />
</factoryAdapter>
</logging>
</common>
<log4net>
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %l - %m%n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="EventLogAppender" />
</root>
</log4net>
我的文件结构如下:
<强> C:\公司名称强> - 根目录的所有项目,点击 C:\公司名称\编译\ BIN - 所有项目的输出目录/在我的解决方案点击类库 C:\公司名称\ lib中 - 如果第三方二进制文件/ DLL是放在
在我的Windows服务项目,我必须石英基准(在C:\公司名称\ lib文件夹)
我还添加到Common.Logging.Log4net.dll参考
当我测试我的应用程序,我得到以下错误:
无法加载文件或组件 “Common.Logging,版本= 2.0.0.0, 文化=中性, 公钥= af08829b84f0328e”或 它的一个依赖。在位于 集清单定义不 不匹配的组件参考。 (从HRESULT异常: 0x80131040) “:” Common.Logging, 版本= 2.0.0.0,文化=中立, 公钥= af08829b84f0328e
解决方案
我想你可能有Common.Logging的版本错误。 Quartz.Net的当前版本使用Common.Logging 1.2版,而不是2.0。如果您需要使用2.0,尝试要么重新编译quartz.net与2.0版本的公共记录的或尝试的重定向组件代替。
其他提示
使用此篇以调试程序集装载,看看是否可以查明不匹配的原因。
不隶属于 StackOverflow