- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试触发 .NET 7 中的编排函数 TimerTrigger
。以下是我创建的函数
[Function(nameof(FunctionSampleTimer))]
public async Task Run([TimerTrigger("*/5 * * * * *", RunOnStartup = false)] MyInfo myTimer, [DurableClient] DurableTaskClient client, FunctionContext context)
{
var instanceid = Guid.NewGuid().ToString();
var logger = context.GetLogger("TimerFunction");
logger.LogInformation($"Function Ran. Next timer schedule = {myTimer.ScheduleStatus.Next}");
}
上述函数仅在项目创建时第一次每 5 秒触发一次,并且不会再次触发并卡在“主机锁租约已获取...”行上。
控制台输出显示:
[2023-02-20T01:26:52.843Z] Azure Functions .NET Worker (PID: 49120) initialized in debug mode. Waiting for debugger to attach...
[2023-02-20T01:26:53.305Z] The next 5 occurrences of the 'FunctionSampleTimer' schedule (Cron: '0,5,10,15,20,25,30,35,40,45,50,55 * * * * *') will be:
[2023-02-20T01:26:53.307Z] 02/19/2023 17:26:55-08:00 (02/20/2023 01:26:55Z)
[2023-02-20T01:26:53.308Z] 02/19/2023 17:27:00-08:00 (02/20/2023 01:27:00Z)
[2023-02-20T01:26:53.309Z] 02/19/2023 17:27:05-08:00 (02/20/2023 01:27:05Z)
[2023-02-20T01:26:53.310Z] 02/19/2023 17:27:10-08:00 (02/20/2023 01:27:10Z)
[2023-02-20T01:26:53.311Z] 02/19/2023 17:27:15-08:00 (02/20/2023 01:27:15Z)
[2023-02-20T01:26:53.312Z]
[2023-02-20T01:26:53.323Z] Host started (775ms)
[2023-02-20T01:26:53.324Z] Job host started
[2023-02-20T01:26:54.472Z] {
[2023-02-20T01:26:54.473Z] "ProcessId": 49120,
[2023-02-20T01:26:54.474Z] "RuntimeIdentifier": "win10-x64",
[2023-02-20T01:26:54.475Z] "WorkerVersion": "1.8.0.0",
[2023-02-20T01:26:54.476Z] "ProductVersion": "1.8.0-local202209270007\u002B04ccbd8e45bb9017dc30ff5e1343e893a216e173",
[2023-02-20T01:26:54.477Z] "FrameworkDescription": ".NET 7.0.0",
[2023-02-20T01:26:54.478Z] "OSDescription": "Microsoft Windows 10.0.22621",
[2023-02-20T01:26:54.479Z] "OSArchitecture": "X64",
[2023-02-20T01:26:54.480Z] "CommandLine": "C:\\Users\\swkandhi\\source\\repos\\FunctionTimerTrigger\\FunctionTimerTrigger\\bin\\Debug\\net7.0\\FunctionTimerTrigger.dll --host 127.0.0.1 --port 58647 --workerId e70ddb42-819a-45b2-a17c-dca35392699d --requestId 326e359b-9d29-4105-b2f1-9ef01892ae95 --grpcMaxMessageLength 2147483647"
[2023-02-20T01:26:54.481Z] }
[2023-02-20T01:26:54.493Z] Worker process started and initialized.
[2023-02-20T01:26:55.053Z] Executing 'Functions.FunctionSampleTimer' (Reason='Timer fired at 2023-02-19T17:26:55.0194750-08:00', Id=872452e5-4d71-42ea-a16d-d4790ccf38a2)
[2023-02-20T01:26:57.821Z] Host lock lease acquired by instance ID '00000000000000000000000074E57A56'.
最佳答案
我在 .NET 7 独立 Azure 函数中观察了每一分钟和几分钟生成 GUID Id 的情况,它运行成功:
以下是我的测试用例:
每分钟:
每 2 分钟:
每 60 秒:
每 5 秒:
据我所知,CRON 表达式中最短的间隔至少需要 60 秒 - Hostinger - Cron Job Tutorial 的文章中也提到了这一点.
关于c# - Azure TimerTrigger 无法在 .NET 7 独立工作进程中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75503472/
这个TimerTrigger没有触发,有人可以在这里提出更好的建议。 public async Task test([TimerTrigger("0 0 11,12 * * 1-5")] TimerI
我正在尝试将 WebJob 作为控制台应用程序运行,当我添加 RunOnStartup = true 时它可以工作,但我需要它仅与 TimerTrigger 一起工作。 这是我的代码 public s
这个TimerTrigger没有触发,有人可以在这里提出更好的建议。 public async Task test([TimerTrigger("0 0 11,12 * * 1-5")] TimerI
我有一个非常简单的网络作业 class Program { static void Main(string[] args) { JobHostConfiguratio
这是我的 Function.Json { "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.28", "configurationSource":
我有一个通过 TimerTrigger 运行的 Azure Function App (v2)(每天午夜 - 美国东部时间)。当我在 Visual Studio 本地运行它时,它工作正常。但是,当我使
这是我的 Function.Json { "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.28", "configurationSource":
我有一个通过 TimerTrigger 运行的 Azure Function App (v2)(每天午夜 - 美国东部时间)。当我在 Visual Studio 本地运行它时,它工作正常。但是,当我使
所以我尝试使用 Azure WebJobs SDK 中的计时器触发器,但它似乎没有触发。 这是我的主要方法 var config = new JobHostConfiguration(); confi
在本文档 ( Timer trigger for Azure Functions ) 中,他们给出的示例每五分钟执行一次该函数,从以 5 或 0 结尾的分钟开始。这很好,但除非我遗漏了某些内容,否则本
我正在尝试创建一个每 x 秒运行一个函数的 Azure WebJob。我正在关注 Microsoft website 上的教程这个示例展示了如何将 TimerTrigger 与 Github 上的 W
我正在寻找一个简单的调度程序来在部署在 Azure 云中的 Java Web 应用程序中执行任务。我正在根据我的要求使用 TimerTrigger 评估 Azure 函数。在这里,我计划定义一个带有回
我遇到 TimerTrigger 实际上并未在我的多个 Azure Functions 中触发。流程看起来总是与此类似: 如日志语句所示,此计时器配置为每 5 分钟触发一次 (0 */5 * * *
每当我创建 TimerTrigger Azure Function 时,都会收到此错误 无法为 ScheduleMonitor 创建 BlobContainerClient。 无论我做什么都会发生这种
每当我创建 TimerTrigger Azure Function 时,都会收到此错误 无法为 ScheduleMonitor 创建 BlobContainerClient。 无论我做什么都会发生这种
我目前正在按照本指南 ( https://learn.microsoft.com/en-us/azure/azure-functions/functions-test-a-function ) 向我的
我正在尝试触发 .NET 7 中的编排函数 TimerTrigger。以下是我创建的函数 [Function(nameof(FunctionSampleTimer))] public
我有一个连续的 WebJob,其函数使用 TimerTrigger 每 30 秒运行一个进程。函数中的特定调用偶尔会看似随机挂起,导致 Web 作业无限期等待。当前的解决方案是通知服务已停止,然后登录
正如我在标题中所说,是否可以有一个使用 TimerTrigger 而不仅仅是 httpTrigger 触发的 azure 持久应用程序?我在这里看到https://learn.microsoft.co
正如我在标题中所说,是否可以有一个使用 TimerTrigger 而不仅仅是 httpTrigger 触发的 azure 持久应用程序?我在这里看到https://learn.microsoft.co
我是一名优秀的程序员,十分优秀!