Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am using TaskScheduler DLL v1.0.4525.29236 to get scheduled jobs properties i.e. staus, Nextrun, Lastrun etc. using asp.net application framework 1.1, language VB.net.

i deployed code on our test server and OAT server which has windows server 2008 R2(64 bit) operating system and IIS v7.5.
It works on test server when i changed application pool as ASP.NET 1.1
but not working on OAT server even i configured IIS same as test server.
it is throwing error msg "object reference not set to an instance of an object"

Check below code
VB
''obejt created
Private tsksch As TaskScheduler.Scheduler

''assign machine name from which we need to read tasks/jobs
tsksch = New TaskScheduler.Scheduler("//" + System.Environment.MachineName())

jobstatus = tsksch.Tasks(jobname).Status.ToString() ''at this line i am getting error 
jobnextrun = Convert.ToString(tsksch.Tasks(jobname).NextRunTime)
joblastrun = Convert.ToString(tsksch.Tasks(jobname).MostRecentRunTime)
strFlags = Convert.ToString(tsksch.Tasks(jobname).Flags)
strExitcode = Convert.ToString(tsksch.Tasks(jobname).ExitCode)


please help me out.
your help is appreciated.

Regards,
Sanjay Gade
Posted
Updated 20-Jun-12 1:08am
v3
Comments
Sandeep Mewara 20-Jun-12 5:39am    
Little strange, you marked and talk of VB.NET but you share code snippet in C#!
renukamubeen 9-Dec-14 3:24am    
how to bind shedular task of windows to gridview in asp.net

1 solution

Object reference not set to an instance of an object
This error happens when you try to use a property or call a method of an object that is null. More details: here[^]

Based on what you report,
C#
jobstatus = tsksch.Tasks(jobname).Status.ToString() //at this line i am getting error 

this simply means either of the following:
1. tsksch was null - failed to find the scheduler to create object
2. tsksch.Tasks(jobname) was null - failed to find any task in scheduler by name mentioned in jobname

find it, and then handle the core reason on why it happened on your server. See if correctly scheduled or not? Scheduler accessible? Some permissions issue?
 
Share this answer
 
Comments
VJ Reddy 20-Jun-12 22:34pm    
Good answer. 5!
Sandeep Mewara 21-Jun-12 16:48pm    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900