I am writing a C# app to automate a file-download from a website. I have written this many different ways. Asynchronous, Synchronous, as a WebForms app, as a 'headless' WinForm and my latest version is a Console App.
I get the same results:
Runs fine in VStudio.
Runs fine on my test server (virtual server) when it is run manually (dbl-click the EXE).
Runs fine when I put it in Task Scheduler and I select 'Run Now' (thereby running it manually in TS).
However, when I schedule the task in the future (example: 5 mins ahead) and log off of the server, some tasks (methods in the code) will not complete and, yet, some will. In other words, the app fails\hangs.
I have tried many, many TS combinations (Running as me, run as admin service account, with highest privileges, set the 'start in' path and many others).
I get the same result. I have researched this like crazy. Tried many samples. Same results.