例如,我创建了一个非常简单的 WebJob TimerTrigger
;
static async Task Main()
{
var builder = new HostBuilder();
builder.ConfigureWebJobs(b =>
{
b.AddAzureStorageCoreServices();
b.AddTimers();
});
builder.ConfigureLogging((context, b) =>
{
b.AddConsole();
});
var host = builder.Build();
using (host)
{
await host.RunAsync();
}
}
}
public class Functions
{
public static void ProcessTimerMessage([TimerTrigger("*/30 * * * * *", RunOnStartup = true)] TimerInfo timerInfo, ILogger logger)
{
logger.LogInformation("I am here");
}
}
当我在 Azure 中运行它时,它永远不会完成。我期待这在每次运行时完成,然后在下一次触发时重新开始。相反,它永远不会停止运行: