.NET creates a scheduled task on the server with error E_ACCESSDENIED

I have an ASP.NET site (in C #) that accepts user data and then tries to create a scheduled Windows task. Of course, this works fine on the DEV machine, but does not work on the server. I am trying to figure out what permissions an ASPNET user (or anonymous web user) needs to create tasks.

Mistake:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 
Stacktrace: 
    at MyScheduler.NewWorkItem(String TaskName, Guid& rclsid, Guid& riid, Object& obj) 
    at MyScheduler.CreateTask(String name)

I did a few searches, and the proposed resolution is to use the web.config flag 'impersonate' to make the application run as a user with sufficient permissions, unlike an ASPNET account that may not have these permissions.

Example:

<system.web>
    <identity impersonate="true" />
</system.web> 

, , , . , , -, , , .

, , . :

<system.web>
    <identity impersonate="true" userName="WindowsDomain\YourUserName" password="YourPassword" />
</system.web> 

Windows. , , Windows 2003 , . , Web.config.

- , , ASPNET ?

EDIT:. API Win32 .

+3
4

, . , , , , :

  • <identity impersonate="true" /> Web.config
  • IUSR (, ) " ".

" ", .

, , . , , , , , , .

+1

, ASPNET, ?

+1

Are you writing something in the event log? Perhaps your component (which is hosted in IIS, which I assume?) Does not have write access to something in the event log.

This is just a hunch ~ some time ago, I ran into a similar problem, and I solved it this way:

Click

0
source

Another option is to output the BIOS to the server on

-4
source

All Articles