使用 Azure Functions 使用户会话保持活动状态

Keeping user session alive with Azure Function

由于我无法使用队列触发基于计时器的函数或为其提供参数(会话 ID 以使其保持活动状态,每 30 分钟刷新一次),是否可以创建一个基本的 HTTP/Queue函数(而不是定时器函数)并在其中添加带有自定义定时器的 c# 代码?该功能是否会触发一次运行永远?

不,正如@Will 在他的评论中提到的那样,您不能永远(连续)使用 Azure 函数 到 运行。由于 Azure Functions 的设计旨在在特定时间限制内减少负载。

time limit of Consumption Plan

The default timeout for functions on a Consumption plan is 5 minutes. The value can be increased for the Function App up to a maximum of 10 minutes by changing the property function timeout in the host.json project file.

因此,作为最佳实践,您应该避免在 Azure Function 中进行长时间的 运行ning 作业。

对于您的用例,您可以使用 Azure Web Apps。 Azure Web 应用程序专为长时间 运行ning 作业而设计。

  1. 您可以创建一个基本的 HTTP/Queue 函数
  2. 这又是你的
  3. Azure Web 应用 Azure Web 应用然后 运行 随心所欲。