I have a .NET app I wrote myself that I'm trying to get set up to run as a scheduled task on Windows Server 2008 R2. When I run the app myself from the command line, it works just fine. However, when I set up the task, it completes the task within 1 second of when it starts and says it completed successfully, though of course the app did NOT run. Because of this, I don't get any errors logged either by the scheduler or by the app. If I take out the argument ("auto") then it "runs" the task, but never opens the console to display the menu.
This is what I've tried so far:
- Telling the task to run the app directly.
- Telling the task to run a batch script that runs the app.
- Telling the task to open cmd.exe with /C "applocation\appname auto" as the argument.
- Changing ownership of the task to the user account created specifically for running tasks (note that that user account works fine for running other tasks).
- Explicitly giving that user account full control over the directories involved.
- Changing ownership of the directories involved to the same user.
- Changing the security permissions on the app to always Run as Administrator.
- Staring at my screen and shaking my head in frustration.
I'm still pretty green with server administration, so it's possible I've overlooked something, but I don't know what that is if I did. I found one question on here that seemed like it was related (GUI doesn't load for a scheduled task) but it's a little different because at least that one actually ran part of the task.
After some more digging, I discovered that the application actually has been running, but due to something I guess I didn't know about the default settings namespace in .NET, the location in the config file where the app stores/reads the web service credentials varies based on whether you're sitting there running the app or the app is being run through TS. Still trying to figure out a way around that...
Regardless, this is where I'm at now: the app spits out SSL/TLS errors whenever the task scheduler attempts to run the app. I have a certificate stored in a subdirectory of the app's home directory (E:\Appname), and as was the case with the credentials, running the app manually causes no problems with the connection. I've ensured that the cert and its folder have the task owner listed with full control.
Am I missing anything else here?