【问题标题】:Quartz.net Job not firing in deployment mode but firing in debug modeQuartz.net 作业不在部署模式下触发,但在调试模式下触发
【发布时间】:2014-01-03 13:31:51
【问题描述】:

我有一个 Quartz.net 工作,每 5 分钟发送一次电子邮件。当我在本地以调试模式运行应用程序时,它运行得非常好。但是当部署到服务器时,作业没有运行。有人能想到原因吗?

我们部署的网站是 IIS 中的 ASP.NET 网站。

【问题讨论】:

  • 它是仅在您的服务器上重现还是在 IIS 下本地重现?
  • 它在我的本地服务器以及两个登台服务器上重现。但不在生产服务器上。它在那里工作得很好。
  • 看看我在Quartz.net scheduler doesn't fire jobs/triggers once deployed 上的回答。希望这会有所帮助。

标签: asp.net iis cron quartz.net


【解决方案1】:

连接这两个“内置”监听器......

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

你需要连接 ILog 的东西。

然后您将能够弄清楚发生了什么和没有发生什么。

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

【讨论】:

  • 感谢您的回答。我刚刚发布了自己的答案,因为经过太多调查最终得到了解决。
【解决方案2】:

我不知道是什么导致了这个问题。我花了很多时间在这上面,但找不到工作没有运行的原因。最后我查看了日志,发现在它前面运行的作业抛出了某种异常,所以我将我的作业从列表中的最后一个移到列表中的第一个,它开始正常工作。还发生了一些奇怪的事情,我并不完全满意它是如何解决的。我想到的其他事情是

  • 我们有许多环境(开发、登台、登台),这些多个环境可能会导致某种冲突,但我认为这不太可能

无论如何,在我重新排序作业后,作业开始运行良好。有趣的是,我在分支中修复了排序,并在开发和暂存环境中修复了它。

【讨论】:

猜你喜欢
  • 2017-08-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多