I am using Microsoft.azure.webjobs (3.0.0-beta1-10941) in a .net core 2 console app. The aim is to create a azure web job,
var config = new JobHostConfiguration();
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
config.UseTimers();
var host = new JobHost(config);
host.RunAndBlock();
The config.UseTimer() is expected a reference of Microsoft.Azure.WebHost.Host but it needs 2.1.0.0. If i add this by removed beta version 3.0.0-beta1-10941 then host.runandblock() falls over at WindowsAzure.Storage incorrectly deployed install edm, data, or data.services.
I installed the dependencies but still no luck
I have downgraded windowsAzure.Storage to lower than 9 but same issue.
Azure WebJobs NuGet Package Error
Any ideas how to resolved config.UseTimes() in .net core 2.0?
Thanks
Any ideas how to resolved config.UseTimes() in .net core 2.0?
In your case you could use the Microsoft.Azure.WebJobs.Extensions Version 3.0.0-beta4. I also do a demo for it. The following is detail steps.
1.Create a net core 2.0 console application.
2.Add the following code in the Program.cs file.
var config = new JobHostConfiguration();
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
config.UseTimers();
config.DashboardConnectionString ="storage connectionstring";
config.StorageConnectionString = "storage connectionstring";
var host = new JobHost(config);
host.RunAndBlock();
3. Add the Functions.cs file to the project.
public class Functions
{
public static void CronJob([TimerTrigger("0 */1 * * * *")] TimerInfo timer)
{
Console.WriteLine("Cron job fired!");
}
}
4. Test it on my side.