Question

I have a Quartz.net job that sends emails every 5 minutes. It runs perfectly fine when I run the application in debug mode locally. But when deploy to the server, the job is not running. Can someone think of a reason why?

Our deployed sites are ASP.NET websites in IIS.

Was it helpful?

Solution 2

I don't exactly what caused the issue. I spend quite a bit of time on this but could not find why the job was not running. Eventually I looked at the log and found that the job that was run ahead of it was throwing some kind of exception, so I moved my job from last in the list to first in the list and it started working fine. There were a couple of weird things that happened as well and I was not completely satisfied how it got resolved. Other things that I think of was

  • We had a number of environments (dev, staging, staging), it is possible there was some kind of conflict caused by these multiple environments however I think it is unlikely

Anyways the job start running fine after I reorder the job. The interesting thing was, I fixed the ordering in a branch and it got fixed in dev and staging environments.

OTHER TIPS

Wire up these two "built in" listeners....

<add key="quartz.plugin.jobHistory.type" value="Quartz.Plugin.History.LoggingJobHistoryPlugin, Quartz" />
<add key="quartz.plugin.triggHistory.type" value="Quartz.Plugin.History.LoggingTriggerHistoryPlugin, Quartz" />

You'll need to wire up the ILog stuff.

Then you'll be able to figure out what is and is not happening.

<configSections>

    <sectionGroup name="common">
        <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>

</configSections>
<common>
    <logging>
        <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
            <arg key="configType" value="FILE" />
            <arg key="configFile" value="~/NLog.config" />
        </factoryAdapter>
    </logging>
</common>

NLog.config

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" internalLogFile="Nlog.log">
    <targets>
        <target name="logfileTargetName" xsi:type="File"   layout="${longdate}|${level}|${callsite}|${logger}|${threadid}|${windows-identity:domain=false}__${message} ${exception:format=message,stacktrace:separator=*"
                fileName="MyNLogLogFile.txt" />

    </targets>
    <rules>

        <logger name="*" minlevel="Trace" writeTo="logfileTargetName"/>

    </rules>
</nlog>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top