I have an issue in triggering Azure webjobs using Webhook url.
I created a simple 'NoAutomaticTriggerAttribute' Azure web job below is the code
For example:
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();
}
}
Below is the Function class code:
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.");
}
}
Now when i tried to call the webjob using the webhook url :
https://sample.scm.azurewebsites.net/api/triggeredwebjobs/SampleWebJob2/run
Its giving this response:
"No route registered for '/api/triggeredwebjobs/SampleWebJob2/run'"
There is no details captured in AzureWebJobsDashboard
Let me know if its the correct way to call the Azure webjobs on demand. Is there any setting that im missing here.
Please guide.
There are indeed some points to note:
RunAndBlock()
in the main method or it will run without stop, it's for continuous WebJob.Then you will be able to run the webjob from WEBHOOK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With