views:

230

answers:

1

I am running a C# .NET 3.5 console app on Windows Server 2003 x64, that I want to run every 5 minutes as a scheduled task. The code runs on schedule and correctly (gathering data and writing to a SQL Server 2005 database) when I am logged into the machine.

When the task runs with no user interactively logged in, it fails with the error message below.

The user running the app is Administrator (this is an internal server/app with no public interface), and the app has run successfully on a different Windows server (x86) for several months, and started failing when I migrated it to the new server.

I have put try-catch blocks on all methods and logged errors to the Event Log, but no errors are logged, so I'm having a problem digging in deeper.

The error:

EventType clr20r3, P1 APPNAME, P2 1.0.0.0, P3 4a89e160, P4 APPNAME, P5 1.0.0.0, P6 4a89e160, P7 2, P8 12f, P9 pszqoadhx1u5zahbhohghldgiy4qixhx, P10 NIL.

I've done a fair amount of Googling, and the most common problem I've seen are DLLs that are not properly installed or referenced. I don't think that is my issue, because I can watch the app run successfully and data get entered into the database as ling as I am logged in.

Any help on this would be quite welcome. Thanks in advance.

Peter

A: 

Make sure the Task Scheduler service is allowed to interact with the desktop as described in How to troubleshoot scheduled tasks in Windows XP and in Windows Server 2003 Also, make sure that "Run only if logged on" is not selected on the task.

JP Alioto
Thanks for that reference, the 'interact with the desktop' option was not set. Unfortunately, it did not get rid of the error. I'm getting the same error I noted above.