【问题标题】:trouble running simple aditi scheduler tutorial运行简单的 aditi 调度程序教程时遇到问题
【发布时间】:2013-09-26 13:25:21
【问题描述】:

我正在尝试遵循简单的 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));
    }


}

【问题讨论】:

    标签: c# asp.net-mvc scheduled-tasks


    【解决方案1】:

    也许问题出在您传递给 WebHookBuilder 的 url 中的“localhost”?

    【讨论】:

      【解决方案2】:

      这已经有几个月了,但我遇到了同样的问题,直到我意识到我的tenantId 和 secretKey 颠倒了(愚蠢,但容易出错)。一旦我交换了它们,它就可以正常工作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-03-08
        • 2016-04-28
        • 2015-10-04
        • 1970-01-01
        • 2022-10-16
        • 2014-09-04
        • 2023-03-25
        • 1970-01-01
        相关资源
        最近更新 更多