Azure Webjobs sdk version 3.x is not overriding cron expression for function trigger from application settings of azure

2020-08-26T05:23:30.403+00:00

Hi,

I'm trying to run Microsoft.Azure.WebJobs version 3.x from .Net framework 4.7.2 environment. I'm not using appsettings.json but have used Name resolver and reading my application settings from app.config.

I'm able to override the values in project.exe.config but not the CRON expression being used for timer trigger for a function. The WebJob is continuous. I have used timer trigger with %% to invoke.

Here is my builder:
var builder = new HostBuilder();
var resolver = new myNameResolver();
builder.ConfigureWebJobs(buil =>
{
buil.AddAzureStorageCoreServices();
buil.AddAzureStorage();
buil.AddServiceBus(servBus=>
{
servBus.MessageHandlerOptions.AutoComplete = false;
servBus.MessageHandlerOptions.MaxConcurrentCalls = myMaxConcurrentCalls;
servBus.ConnectionString = myServiceBusConnectionString;
servBus.MessageHandlerOptions.MaxAutoRenewDuration = TimeSpan.FromHours(12);
});
buil.AddTimers();
});
builder.ConfigureServices(serv => serv.AddSingleton<INameResolver>(resolver));
builder.ConfigureHostConfiguration(config =>
{
config.AddInMemoryCollection(BuildConfiguration(myStorageConnectionString));
config.AddEnvironmentVariables();
});
builder.ConfigureAppConfiguration(buil => buil.AddEnvironmentVariables());

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,244 questions
0 comments No comments
{count} votes

Accepted answer
  1. Krish G 2,331 Reputation points
    2020-08-26T16:49:04.01+00:00

    You can not override cron expression in custom way (appsettings or app.config or code). Either you can set it in the portal or include a settings.job file at the root of your WebJob .zip containing the expression like below for example:

    {  
        "schedule": "0 */15 * * * *"  
    }  
    

    as documented here.

    0 comments No comments

0 additional answers

Sort by: Most helpful