Cannot instantiate the TaskService on a WCF service

Mar 16, 2010 at 5:49 PM

Trying to create\instantiate a TaskService object but not able to without providing a user id and password, I should mention also that a web application is pulling the task scheduler data via a WCF Service. Both the web application and the WCF service are hosted on the same server within IIS. I guess my question is can I instantiate the object in this scenario without providing a user id and password? The web service provides interface\contract to retrieve the data from the task scheduler.

                using (TaskService ts = new TaskService())
                {
                    for (int i = 0; i < ts.RootFolder.Tasks.Count; i++)
                    {
                        // do somthing....

                    }
                }

Web App <--> WCF Service <--> Task Scheduler

 

Coordinator
Mar 16, 2010 at 7:27 PM

Your web app and WCF service are each running in the context of some local or domain account. That account's token is the one being used when you instantiate a TaskService without a username and password so it must have the security permission to access local system resources like the Task Scheduler. If you find another solution, please post it here.