Try our conversational search powered by Generative AI!

Scheduled task errors when run automaticaly

Vote:
 

Hi,

I have created a scheduled task to parse and XML file and setup some pages from it. This all worked fine when run manualy, however when I aurtomate it, it fails with "Object reference not set to an instance of an object". I'm not sure how to debug this, but as a test I removed all functionality from the Execute method and just returned a string "test" and this fails in the same way when triggered automaticaly.

Does anybody have any idea what the issue might be? and how I could debug it?

Many thanks

Matt

#34008
Oct 23, 2009 22:15
Vote:
 

Maybe you have a issue where the user that runs the job does not have the correct permissions?

Have a look at this: http://labs.episerver.com/en/Blogs/Ted-Nyberg/Dates/112276/8/Run-a-scheduled-job-as-a-specific-EPiServer-user/

#34029
Oct 26, 2009 14:13
Vote:
 

I have tried that with no joy. My current code is:

    [EPiServer.PlugIn.ScheduledPlugIn(DisplayName = "Reel Content Service")]
    public class ReelContentTask
    {
        static ReelContentTask()
        {
            if (PrincipalInfo.CurrentPrincipal.Identity.Name == string.Empty)
            {
                PrincipalInfo.CurrentPrincipal = PrincipalInfo.CreatePrincipal("Admin");
            }
        }

        public static string Execute()
        {
            return "test";
        }
    }

#34031
Edited, Oct 26, 2009 14:31
Vote:
 

Check here for some other tips&tricks: http://antecknat.se/blog/2009/03/04/scheduled-tasks-tips/

One thing could be that another dev computer is running the job before your computer does.

#34032
Oct 26, 2009 15:09
Vote:
 

Thats it. Man, I've been pulling my hair out over this. We have a shared dev database and one of the developers had his clock set faster than mine so his was trying to execute the task. The annoying thing is, i'd been to that page and followed the steps for the "Object reference to set to an instance of an object" issue. Moral of the story, read the whole article.

Thanks again.

#34033
Oct 26, 2009 15:33
Vote:
 

I vote for a new field in the scheduled task status logs: "Machine Name" where the job has been run. I've been bitten by this problem too many times to count.

/Steve

#34034
Oct 26, 2009 16:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.