【发布时间】:2019-03-25 13:51:15
【问题描述】:
我在使用 Webhook url 触发 Azure webjobs 时遇到问题。
我创建了一个简单的“NoAutomaticTriggerAttribute”Azure Web 作业,下面是代码
例如:
class Program
{
// Please set the following connection strings in app.config for this WebJob to run:
// AzureWebJobsDashboard and AzureWebJobsStorage
static void Main()
{
var test = ConfigurationManager.ConnectionStrings["AzureWebJobsDashboard"].ConnectionString.ToString();
var config = new JobHostConfiguration(test);
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
var host = new JobHost(config);
host.Call(typeof(Functions).GetMethod("ProcessMethod"));
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
}
下面是函数类代码:
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
[NoAutomaticTriggerAttribute]
public static void ProcessMethod(TextWriter log)
{
log.WriteLine("This is First call from Main Method.");
}
}
现在,当我尝试使用 webhook url 调用 webjob 时:
https://sample.scm.azurewebsites.net/api/triggeredwebjobs/SampleWebJob2/run
它给出这个响应:
“没有为'/api/triggeredwebjobs/SampleWebJob2/run'注册路由”
AzureWebJobsDashboard 中没有捕获任何细节
如果它是按需调用 Azure webjobs 的正确方法,请告诉我。这里有没有我缺少的设置。
请指导。
【问题讨论】:
标签: azure azure-webjobs