yuzd / Hangfire.HttpJob

httpjob for Hangfire,restful api for Hangfire,job调度与业务分离
https://github.com/yuzd/Hangfire.HttpJob/wiki
MIT License
626 stars 185 forks source link

BadRequest 求解 #115

Closed jaronsoft closed 3 years ago

jaronsoft commented 3 years ago

使用 读取 json 的方式加载,收到了 BadRequest ,求解?谢谢

List<Hangfire.HttpJob.Client.RecurringJob> JobAgentList = JsonConvert.DeserializeObject<List<Hangfire.HttpJob.Client.RecurringJob>>(FileHelper.ReadString(JobAgentConfig));
foreach (Hangfire.HttpJob.Client.RecurringJob item in JobAgentList)
{
var serverUrl = "http://localhost/hangfire";
var result = HangfireJobClient.AddRecurringJob(serverUrl, item,
new HangfireServerPostOption { BasicUserName = "admin", BasicPassword = "test" });
}
    {
        "RecurringJobIdentifier": "SIGNALR_TEST",
        "Url": "https://localhost/api/Do/1",
        "Method": "GET",
        "Data": "",
        "ContentType": "application/json",
        "Timeout": 5000,
        "DelayFromMinutes": 15,
        "Cron": "* 0/12 * * *",
        "JobName": "SIGNALR_TEST",
        "QueueName": "default",
        "AgentClass": "",
        "AgentTimeout": 0,
        "EnableRetry": true,
        "RetryDelaysInSeconds": "20,30,60",
        "RetryTimes": 3,
        "Headers": {},
        "CallbackEL": "",
        "TimeZone": "Asia/Shanghai"
    }

附 nginx 日志: 127.0.0.1 - admin [20/Mar/2021:15:23:01 +0800] "POST /hangfire//httpjob?op=addrecurringjob HTTP/1.1" 400 0 "-" "-" "-"

yuzd commented 3 years ago

F849ACF5-A5A9-484C-AF8C-E3C82C3B9797

jaronsoft commented 3 years ago

已解决。多谢