COMException when calling FindAllTasks on IIS

Topics: Errors
Mar 25, 2014 at 1:51 PM
Edited Mar 25, 2014 at 1:53 PM
Hello!

To start with, I have read a lot of threads that have similar issues, but the solutions dont seem to be applicable in my case.

The exception I get is this:
[COMException (0x80041318): The task XML contains a value which is incorrectly formatted or out of range. (Exception from HRESULT: 0x80041318)]
   Microsoft.Win32.TaskScheduler.V2Interop.IRegisteredTask.get_Definition() +0
   Microsoft.Win32.TaskScheduler.Task.CreateTask(TaskService svc, IRegisteredTask iTask) +924
   Microsoft.Win32.TaskScheduler.V2TaskEnumerator.get_Current() +40
   Microsoft.Win32.TaskScheduler.V2TaskEnumerator.MoveNext() +37
   System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) +454
   Microsoft.Win32.TaskScheduler.TaskService.FindTaskInFolder(TaskFolder fld, Regex taskName, List`1& results, Boolean recurse) +65
   Microsoft.Win32.TaskScheduler.TaskService.FindAllTasks(Regex name, Boolean searchAllFolders) +69
The code that calls FindAllTasks works fine as long as I call it from Visual Studio (Windows 7). But if I publish the project to the webserver running IIS 7 on Windows WebServer 2008, it fails.

I checked the XML from one task that I receive, and it says that the Task version is 1.2.

Any ideas?

(The parameters I use are regex matching anything (.*) and false for the searchAllFolders)
Coordinator
Apr 10, 2014 at 1:25 AM
Try now with the 2.1.0 release. This problem should be resolved, but let me know if it isn't.
Apr 23, 2014 at 12:11 PM
Edited Apr 23, 2014 at 12:40 PM
It seems to run now!

But I do have a small issue on one of the servers, from which I retrieve tasks. I get an InvalidOperationException with the message:

"The current version of the native library (1.2) does not support the original or minimum version of the "User_Feed_Synchronization-{77CB3D00-5AB4-408A-90BB-65BCFFAE25EE}" task (1.3/1.3)"

I get the exception if I try to read the IsActive property from the task.

This only happens if I run from the webserver, as in the original post.
Coordinator
Apr 24, 2014 at 4:34 AM
Edited Apr 24, 2014 at 4:36 AM
What this is saying is that there are settings in the task that will allow it to only be consumed by a Windows 7 (1.3) native library and that you are on 1.2 (Vista or equivalent server). One thing you can do now with the 2.1.1 library is set the AllowReadOnlyTasks property to true on the TaskService instance. This should then allow you to get tasks from upstream servers that are "stripped" of any settings that cannot be read by the downstream system. Note however, that if a task's ReadOnly property is set, then you cannot edit it at all.
Marked as answer by dahall on 4/23/2014 at 9:36 PM