This project has moved. For the latest updates, please go here.

Unable to create tasks from ASP.NET under W2008

Oct 30, 2012 at 4:17 PM
Edited Oct 30, 2012 at 4:18 PM


whenever I try to create tasks from an ASP.NET web app on a W2008 R2 server, I receive this exception:


System.Runtime.InteropServices.COMException: (39,8):Command:


The code I wrote resembles the samples I found here, and I already tried a lot of permutations of the RegisterTaskDefinition method, so I cannot understand what's the problem. Basically I call NewTask, add one action and one trigger, a start boundary and that's all, and finally I call RegisterTaskDefinition. I tried to call it without specifying credentials, or with my credentials, or with SYSTEM userId, with all the LogonTypes, I really tried a lot of things there, so I guess it must be something else.

If I create a task manually from the Task Scheduler UI I have no problems, and then if I try to modify the same task from the same ASP.NET web app I'm building everything works fine, the problem is only limited to the task creation phase. The ASP.NET app impersonates the same user account I use to create and edit the tasks manually from the Task Scheduler UI.

The very same code works fine when I use on my dev machine, which is an XP (hence using Task Scheduler 1.0).

Any thoughts?



Oct 31, 2012 at 4:29 PM

Update: I was able to solve my problem moving from RegisterTaskDefinition to RegisterTask method (Xml definition).