来自web.config的Sitecore任务配置

时间:2012-05-03 18:33:58

标签: scheduled-tasks sitecore sitecore6

我正在尝试将任务配置为每5秒运行一次(在生产中,频率将设置为30分钟,但我将其设置为5秒进行调试)。

<scheduling>
  <!-- Time between checking for scheduled tasks waiting to execute -->
  <frequency>00:00:10</frequency>
....
<agent type="MyStuff.Sitecore.Tasks.UpdateJob" method="Run" interval="00:00:05">
        <LogActivity>true</LogActivity>
      </agent>

我的课看起来像:

namespace MyStuff.Sitecore.Tasks
{
    public class UpdateJob
    {
       public void Run()
       {
          //debugger never enters here
       }
    }
}

但无论如何,代码似乎永远不会被调用。我试过点击其他网页,所以我知道asp.net工作进程还活着。

该类位于在网站项目中调用的共享库中,因此无论找到MyStuff.Sitecore.Tasks.UpdateJob类型的sitecore配置都应该能够找到它。此外,我已经检查了Sitecore日志,我没有看到任何关于任务的错误或任何事情

知道我错过了什么吗?


编辑我在日志中看到的唯一“可疑”是:

ManagedPoolThread #12 15:53:10 INFO  Starting update of index for the database 'master' (1 pending).
ManagedPoolThread #12 15:53:10 INFO  Update of index for the database 'master' done.
ManagedPoolThread #18 15:53:36 ERROR Exception in geoip worker thread.
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType)
   at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct signature, RuntimeType declaringType)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type, Object[] parameters)
   at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)
   at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.Factory.GetProviders[TProvider,TCollection](List`1 nodes)
   at Sitecore.Configuration.Factory.GetProviders[TProvider,TCollection](String rootPath, TProvider& defaultProvider)
   at Sitecore.Configuration.ProviderHelper`2.ReadProviders()
   at Sitecore.Configuration.ProviderHelper`2.get_Provider()
   at Sitecore.Analytics.Lookups.GeoIpWorker.ProcessGeoIp()
   at Sitecore.Analytics.Lookups.GeoIpWorker.<Wakeup>b__3(Object a)

我正在使用Sitecore 6.5

3 个答案:

答案 0 :(得分:3)

您可以尝试将代理声明更新为<agent type="Mystuff.Sitecore.Tasks.UpdateJob, Mystuff" method="Run" interval="00:00:05">,其中Mystuff是您的程序集名称。好像装配丢失了。

根据techphoria414的建议添加了答案。

答案 1 :(得分:0)

虽然我稍微踩了一下你的问题,但是在处理预定任务时,我从来没有成功调用调试器。我改为使用Sitecore.Diagnostics.Log,然后使用我想要显示的相关调试级别。通常我发现这相当有限,但使用第三方尾部实用程序,您可以在发生时轻松地查看日志。

也许这会给你一个interm解决方案,直到其他人回答。

答案 2 :(得分:0)

答案在于<frequency>00:00:10</frequency>,这应该始终与最常见的任务一样低,所以在这种情况下00:00:05。

相关问题