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

Schedule via ASP.NET

Apr 16, 2012 at 6:53 AM


I tried to schedule the task via ASP.NET application running in IIS 7.5 in Windows 2008 R2 environment.

The error message is

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



An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired .

I went to C:\Windows\System32\Tasks folder to give full permission to Network Service(the application pool that run the web application) but still having the same error above.  I also given full access to Everyone group but still not able to schedule.

 Anybody having the same error?



Apr 16, 2012 at 10:53 AM


I have managed to resolve this issue.

Just create the TaskDefinition td = ts.NewTask() without assigning the user id and password.

Jul 16, 2012 at 1:12 PM


TaskService ts = new TaskService();
Version ver = ts.HighestSupportedVersion;
bool newVer = (ver >= new Version(1, 2));
TaskFolder tf = ts.RootFolder;


This might works?