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 .