use*_*025 5 azure azure-webjobs
我在使用 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();
}
}
Run Code Online (Sandbox Code Playgroud)
下面是函数类代码:
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.");
}
}
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试使用 webhook url 调用 webjob 时:
https://sample.scm.azurewebsites.net/api/triggeredwebjobs/SampleWebJob2/run
它给出了这个回应:
“没有为‘/api/triggeredwebjobs/SampleWebJob2/run’注册路由”
AzureWebJobsDashboard 中未捕获任何详细信息
让我知道这是否是按需调用 Azure webjobs 的正确方法。有没有我在这里遗漏的任何设置。
请指导。
确实有一些需要注意的地方?
RunAndBlock()在main方法中delete ,否则会不停地运行,是为了连续的WebJob。然后您将能够从 WEBHOOK 运行 webjob。
| 归档时间: |
|
| 查看次数: |
4500 次 |
| 最近记录: |