我使用Microsoft Azure计划管理库(https://www.nuget.org/packages/Microsoft.WindowsAzure.Management.Scheduler/)在Azure计划程序中安排作业。到目前为止,按分钟,小时和天创造就业机会工作正常。
我的问题是如何安排一周中指定日期的每周作业。下面的代码会导致消息" BadRequest异常:无法使用重复单位'周'来设置几个月的日期。"。我无法看到我在哪里设置"月份"如异常中所述。 Days集合被描述为"作业应该执行的星期几"。
var result = _azureSchedulerClient.Jobs.CreateOrUpdate("My Job", new JobCreateOrUpdateParameters()
{
Action = _azureSchedulerJobAction,
StartTime = startDateTime,
Recurrence = new JobRecurrence()
{
Frequency = JobRecurrenceFrequency.Week,
Interval = 1,
EndTime = new DateTime(2014, 12, 31);
Schedule = new JobRecurrenceSchedule()
{
Days = new List<JobScheduleDay> { JobScheduleDay.Monday }
}
}
});
是否有人能够每周安排工作?感谢。
答案 0 :(得分:0)
JobCreateOrUpdateResponse jobResp = schedClient.Jobs.CreateOrUpdate("testRecurrenceIssue", new JobCreateOrUpdateParameters
{
Action = new JobAction
{
Request = new JobHttpRequest { Uri = new Uri("http://www.bing.com"), Method = "GET" },
},
Recurrence = new JobRecurrence
{
Frequency = JobRecurrenceFrequency.Week,
Schedule = new JobRecurrenceSchedule
{
Days = new List<JobScheduleDay> { JobScheduleDay.Monday},
Hours = null,
Minutes = null,
MonthDays = null,
MonthlyOccurrences = null,
Months = null
}
}
});