使用Webhook网址触发Azure webjob时遇到问题。
我在下面的代码中创建了一个简单的'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();
}
}
下面是Function类代码:
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网址调用webjob时:
https://sample.scm.azurewebsites.net/api/triggeredwebjobs/SampleWebJob2/run
它给出了以下响应:
“没有为'/ api / triggeredwebjobs / SampleWebJob2 / run'注册的路由”
AzureWebJobsDashboard中没有捕获任何详细信息
让我知道它是否是按需调用Azure webjobs的正确方法。这里有什么我想念的地方吗?
请指导。