I have an application that works on my old Windows 2008 R2 server in Task Scheduler very nicely. It reads data from one web service and then writes some data to another Web Service (so it needs network access). It has been running equally well in Explorer or in Task Scheduler for the last few years. I am running the process as an Domain Administrator (for simplicity-sake).
I have been working upon migrating the application from the old to new 2012 R2 server and it has required a few changes in code, which is not bad. However, I have come up against an issue that has me completely foxed.
The application runs correctly now, IF I double-click the EXE in Explorer and it does its work. However, when I try to run the application in Task Scheduler using the same user and settings as with the old server, it runs for a few seconds and then stops (it should run for 2 minutes).
I have set up an audit log and this is not showing anything. However, I see that the Windows Application log shows a couple of errors after the process gets killed:
Application: WebInterfacer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.InteropServices.COMException at SHDocVw.IWebBrowser2.get_Busy() at WebInterfacer.Transferer.waitForIE(SHDocVw.InternetExplorer) at WebInterfacer.Transferer.setTimes(Int32, System.String, System.String, System.Collections.Generic.List`1<ZoneEvent>, SHDocVw.InternetExplorer, System.String ByRef) at WebInterfacer.Transferer.GetAndSetData(System.Collections.Generic.Dictionary`2<System.String,Double>, WebInterfacer.BookingService.Lists, System.String, System.String, System.String, Int32, System.String ByRef) at WebInterfacer.Transferer.Main(System.String)
And the second one:
Faulting application name: WebInterfacer.exe, version: 18.104.22.168, time stamp: 0x588f5ae8 Faulting module name: KERNELBASE.dll, version: 6.3.9600.18340, time stamp: 0x5736541b Exception code: 0xe0434352 Fault offset: 0x00014878 Faulting process id: 0x2ae4 Faulting application start time: 0x01d27b2075396488 Faulting application path: C:\Program Files\Internal\Transferer\WebInterfacer.exe Faulting module path: C:\Windows\SYSTEM32\KERNELBASE.dll Report Id: b8a9ddf0-e713-11e6-80be-42f2e9a1fc19 Faulting package full name: Faulting package-relative application ID:
When I added in some extra error-checking code, I got "The message filter indicated that the application is busy. Error HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER)". Why is it busy? Could it be that there is a policy that stops application code from interacting with IE on Windows 2012 R2 in a shell?
I have set the process to run whether the user is logged on or off. It is set to run with the highest permissions. This is the same in both versions on two different servers.
I am wondering if there is something wrong with the SHDocVw.InternetExplorer and the COM object there, but why is it failing when run in Task Scheduler, but not manually?
Thanks in Advance
There are many possible reasons it could fail here.
You have to debug it. You need to catch the exception in your code and study the data the exception provides. This way you can find the ultimate reason for the error.
My educated guess here is that the code runs IE, and waits for its output. The environment in tasks launched from Scheduler might differ so that IE or some other component cannot function properly, and therefore it throws an exception.
User contributions licensed under CC BY-SA 3.0