Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Windows Scheduler: Error details: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

$
0
0

Windows Scheduler: Error details: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))


To whom it may concern,

I have used a "TaskHelper" in my Lightswitch App that assist with the Scheduling of Tasks via the Windows Scheduler.

Everything works fine on my Local Machine.

When I deploy my app and I try to Schedule a task via my App I receive the following error:

"Error details: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

I make use of the following Code:

// Create a new task definition and assign properties
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = TaskName; //Variable  Containing the Name of the Task
td.RegistrationInfo.Author = User; //Variable Containing the Current User Name
td.RegistrationInfo.Date = DateTime.Now;
td.Principal.UserId = "SYSTEM";
td.Principal.LogonType = TaskLogonType.ServiceAccount;  

The rest of the Task Details is done later in my program, but the problem area is the above Code.

I have tried the following already:

  1. Ensured that ASPNET, SYSTEM as well as My own credentials has all the Rights in the C:\Windows\System32\Tasks Folder
  2. Added ASPNET, SYSTEM as well as My own credentials to the DCOMCNFG(Even Everyone)
  3. Tried different Task Logon Types
  4. Change Authentical From Integrated to my own credentials in IIS (As a test)
  5. Everything works on my Local Machine using all the different Scenarios mentioned above. The task is scheduled and executes fine via my app on my local machine.

When I schedule the Task Directly in the Scheduler, with the My User Credentials, Everything works fine.  I also Scheduled The task manually and selected SYSTEM as the "Execute As" User.  This worked fine 

The App is a Browser based app. I make use of Integrated Security (I did use my own credentials in all the tests mentioned above).

The server that I try to run this app on is MS Server 2008 Service Pack 2.

I use the following command to create the actual task:

ts.GetFolder("Folder\\Subfolder").RegisterTaskDefinition(TaskName, td); //These folders already exists and they work file on my Local  Machine.  I Also tried without the actual folders (Directly in the root, with the same result)

Any Assistance will be appreciated.

Kind Regards,



Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>