You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am trying to register a task through a web app deployed to an IIS server (Windows Server 2012 R2).
The task is to be run one time only. Action is set to be opening the notepad for testing purpose.
Use the official one by debugging in localhost is fine but runs into the same error when deployed to server. I have searched over the code and I have no idea what required element or attribute I have missed. Use the wrapper by debugging in localhost also run to an access denied error no matter with or without an admin account.
I am wondering if that is a problem of account permission but adding an account in the Task service config and task registration part only bring more errors like access denied or something like:
Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014)
The tutorial on Task Security provides several approaches but I have tried all possibilities:
local computer (no account vs admin account)
remote server (NETWORK SERVICE & admin account & no account)
interactive token vs account password
system account
admin right of setting the highest property
I have been struggling in the task registration...
Is it better to get an admin account to get it work ? resulting in a bunch or access error though :(
Thanks in advance for any advice.
Update:
The missing requirement issue was solved by changing the time trigger to td.Triggers.Add(new TimeTrigger() { StartBoundary = send_time });
locally but the problem is still there to make it work on remote server.
Thanks.
The text was updated successfully, but these errors were encountered:
Are you impersonating the user in your IIS session? If not, doing so will allow TaskService to be creating using the user credentials instead of IUSER credentials (which are usually restricted).
Hello,
I am trying to register a task through a web app deployed to an IIS server (Windows Server 2012 R2).
The task is to be run one time only. Action is set to be opening the notepad for testing purpose.
using (TaskService ts = new TaskService())
{
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Open notepad";
td.Principal.LogonType = TaskLogonType.InteractiveToken;
DateTime time = Convert.ToDateTime(txttime.Text);
DateTime date = Convert.ToDateTime(txtdate.Text);
DateTime send_time = date.Add(time.TimeOfDay);
td.Triggers.Add(new TimeTrigger(send_time));
td.Actions.Add(new ExecAction("notepad.exe", null, null));
//td.Principal.RunLevel = TaskRunLevel.Highest;
TaskFolder tf = ts.GetFolder("\\Microsoft\\Windows\\Notepad");
tf.RegisterTaskDefinition(taskName, td);
}
Use the official one by debugging in localhost is fine but runs into the same error when deployed to server. I have searched over the code and I have no idea what required element or attribute I have missed. Use the wrapper by debugging in localhost also run to an access denied error no matter with or without an admin account.
I am wondering if that is a problem of account permission but adding an account in the Task service config and task registration part only bring more errors like access denied or something like:
The tutorial on Task Security provides several approaches but I have tried all possibilities:
I have been struggling in the task registration...
Is it better to get an admin account to get it work ? resulting in a bunch or access error though :(
Thanks in advance for any advice.
Update:
The missing requirement issue was solved by changing the time trigger to
td.Triggers.Add(new TimeTrigger() { StartBoundary = send_time });
locally but the problem is still there to make it work on remote server.
Thanks.
The text was updated successfully, but these errors were encountered: