November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
If a scheduled job works when run manually but fails with exceptions when runned through scheduler the most likely cause is that code assumes an HttpContext.Current to be present.
Note that when running from the scheduler, there will be no HttpContext.Current available.
If your scheduled job _really_ only consists of the code above, then its a little more mysterious. Make sure that its really *this* job that fails ant not something else.
Regards,
Johan
Hi
Johan makes some good points. If the code above fails with a NullReferenceException when run scheduled, the problem must be with the scheduler.
First of all, make sure that the EPiServer Scheduler service is up and running without any problems. Also try some of the built in scheduled jobs, are they working when run schduled?
This is just a sample scheduled job that I have created , As this also gives me same result, Instead of writing all the code which is in my actual scheduled job.
I tried to create some other jobs also which are available over net. But for all I got the same error. All of them are working for "StartMannually"
All the other scheduled jobs including builtin scheduled jobs are running fine.
When I put a breakpoint at the "Execute" function of the scheduled job it is not stoping at that for the scheduled time though visual studio is in Run mode. It is stoping there only for "StartMannually".
I am using visual studio 2003 and EPiServer 4.
Please suggest me some solution,
If the debugger stops on a job executed by start manually you have attached the debugger to the web-process.
If you want to debug something executed from the scheduler you must attach the debugger to the scheduler-process.
Not entirely true, the job will still be executed within the context of the webapplication.
The schedulerprocess is just keeping track of *what* job and *when* to execute; the "execution" is then runned inside the webapplication.
If you are unable to hit your breakpoint when running through the scheduler, the problem must be a crash *before* youre jobs Execute() method is called, possibly inside the scheduler code itself.
The reason I asked if the initially posted code *really* was all the jobs code consisted of was that it doesnt seem syntactically correct; theres one rightbracket ( '}' ) too many at the end to satisfy the compiler.
Now this could of course be due to a slip on the keyboard when submitting the post, but if code was copied and pasted, then perhaps some crucial parts were left out?
Regards,
Johan Olofsson
The schedulersvc process doesnt run the job - it triggers its execution through remoting into the webapplications context. The job is then executed within the webapplication.
/johan
I am able to run the scheduled job for the scheduled time, But very often it is succesful.
When I left the scheduled job running for al long time with specific intervels set for Next scheduled date and time.
Randomly it is failing.
Some times throwing error as
"Object reference not set to an instance of an object"
and some times
"Exception has been thrown by the target of an invocation.[The source was not found, but some are all event logs could not be searched. Inaccessable logs:Security.]
The same code is successfull some times.
Can any body please let me know the reason for this.
Is the site running on several servers/development machines with one shared database?
Hi Erik,
Yes you are correct our site is running on several servers and developers from onsite and offshore are using a common database on different server.
Is this a problem?
I have the same problem, does anyone solve this?
That will save a lot of my time.
Hi I have created a sample scheduled job with code
using System;
using EPiServer;
using EPiServer.plugIn;
namespace development{
[EPiServer.plugIn.ScheduledPlugIn(displayname="Samplescheduler")]
public class samplescheduler
{
public samplescheduler()
{}
public static string Execute()
{
return System.DateTime.Now.ToString();
}
}
}
}
I am able to debug this by clicking on "StartMannually" button. But not for the scheduled time. And for the scheduled time it is failing and giving message as "Object reference not set to an instance of an object".
Can anybody help me in this . Do I need to do any settings.