I'dp have the following issue.
In a (webapplication) I create a taskdefinition
Can there be a reason for this behaviour?
When I stay connected to the server it will keep continue to run.
Thanks in advance
Wijnand Beke
The Netherlands
In a (webapplication) I create a taskdefinition
var cmd = @"restart.cmd";
var taskName = string.Format("restart_{0}", DateTime.Now.ToString("yyyyMMMMdd_HHmm"));
TaskDefinition td = ts.NewTask(); td.RegistrationInfo.Description = taskName;
td.Triggers.Add(new TimeTrigger() {StartBoundary = DateTime.Now});
td.Actions.Add(new ExecAction(cmd, null, null));
td.Settings.Compatibility = TaskCompatibility.V2_1;
td.Settings.ExecutionTimeLimit = TimeSpan.FromMinutes(15); // also tried without this line
td.Principal.LogonType = TaskLogonType.InteractiveToken; // also tried without this line
task = ts.RootFolder.RegisterTaskDefinition(taskName, td, TaskCreation.CreateOrUpdate, @"domain\adminusername","pwd");
// Remove the task we just created
if (task != null)
{
task.Run();
// Remove the task we just created
ts.RootFolder.DeleteTask(taskName);
}
The website is running on windows 2012. When I close the connection to the server, do not log off, the task is not runned any more. No error message, nothing. But it simply does not run. Can there be a reason for this behaviour?
When I stay connected to the server it will keep continue to run.
Thanks in advance
Wijnand Beke
The Netherlands