我正在尝试遵循简单的 Aditi Scheduler 教程,但出现错误。这是我的代码。
我究竟做错了什么?
错误:输入不是有效的 Base-64 字符串,因为它包含非 base 64 字符、两个以上的填充字符或填充字符中的非法字符。
[TestMethod]
public void ScheduledSMS()
{
var tenantId = "xxxxxxxxxxxmyid";
var secretKey = "xxxxxxxxxxxmykey";
var scheduledTasks = new ScheduledTasks(tenantId, secretKey);
// create a task
var task = new TaskModel
{
Name = "My first Scheduler job",
JobType = JobType.Webhook,
// use predefined CommonCronExpressions or build your own CRON expressions here http://cronmaker.com/
CronExpression = CommonCronExpressions.EveryMinute,
// use builders to set job properties for webhooks and azure queue
Params = ParamBuilderFactory
.WebHookBuilder("http://localhost:1901/SMS/SendText")
.Build()
};
var operationId = scheduledTasks.CreateTask(task); <------ Error happens here..
// all operations in the api follow fire and forget approach, once an operation like create/update/delete
// is requested it returns an operationId(Guid) which can be used to fetch the operation status
// operation status can be fetched in two ways:
// method 1: (without polling) returns the status without polling
var operationStatus = scheduledTasks.GetOperationStatus(operationId);
// method 2: (with polling) polls until the operation status changes to success/error or a timeout occurs
// var operationStatus = scheduledTasks.GetOperationStatus(operationId, true);
// get the task
TaskModel newTask = null;
if (operationStatus.Status == StatusCode.Success)
{
dynamic resultData = operationStatus.Data;
var newTaskId = resultData["Id"];
newTask = scheduledTasks.GetTask(Guid.Parse(newTaskId));
}
}