Azure Timer trigger is not working in .net 5 isolated function app

Viewed 981

Azure Timer trigger is not working in .net 5 isolated function app with the CRON expression to get triggered for every minute. This is working fine if we run that in local visual studio.

public static class NotificationScheduler {

[Function("NotificationScheduler")]

    public static void Run([TimerTrigger("1-2 * * * * *")] MyInfo myTimer, FunctionContext context)
    {

        var logger = context.GetLogger("NotificationScheduler");
        logger.LogInformation($"Notification Scheduler trigger function executed at: {DateTime.Now}");
        //logger.LogInformation($"Next timer schedule at: {myTimer.ScheduleStatus.Next}");

       
    }
}
1 Answers

As per your ask I have run the function in my local environment and it is working fine for me below is my code for reference make changes accordingly on your environment.

  1. Created Function App in Azure Portal

enter image description here 2. Below is the Code which I have Used in function App

enter image description here

Function1.cs

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;


namespace KrishFuncTimerTriggerApp
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([TimerTrigger("0 * * * * *")]TimerInfo myTimer, TraceWriter log)
        {
           log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
        }

      
}
  1. Then I went to Code+Integration and when I did a Test Run my function app ran every minute as per my logic

enter image description here

  1. As per the below Image .Net isolated function is not supported for editing in Azure Portal.

enter image description here

Also, try to check your SDK version as per this SO and blog if you are using SDK version "6.0.100-preview.7.21379.14" as it is in Preview could be the reason why your function app is not working, if that is the case then try to downgrade your function app.

Also Check the Cron expression link for further details

Related