English 中文(简体)
Quartz.net and Common.Logging - Using Log4Net
原标题:

I m using Quartz.net within a windows service. Currently, the trigger is not firing - I d like to use the logging to find out why.

I have edited my config file for the windows service:

<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>

My file structure is as follows:

C:CompanyName - root dir for all projects
C:CompanyNameuildin - Output directory for all projects / class libraries in my solution
C:CompanyNamelib - Where 3rd party binaries / dlls are put

In my Windows Service project, I have a reference to Quartz (in the C:CompanyNamelib folder)

I have also added a reference to Common.Logging.Log4net.dll

When I test my app, I get the following error:

Could not load file or assembly Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e or one of its dependencies. The located assembly s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e

最佳回答

I think you might have the wrong version of Common.Logging. The current version of Quartz.Net uses the Common.Logging version 1.2, not 2.0. If you need to use 2.0, try either recompiling quartz.net with the 2.0 version of common logging or try redirecting the assembly instead.

问题回答

Use this post to debug the assembly loading to see if you can pinpoint the cause of the mismatch.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签