c# - 发布新版本时,正在运行的 Azure Function 是否完成或终止?

标签 c# azure-functions

有谁知道如果在当前运行的 Azure Function (.NET Core) 运行的同时发布,会发生什么情况:

是吗: 1. 完成其工作并在下次首先使用更新的代码运行 2. 运行中途被终止? 3.还有什么吗?

我的猜测是 1,但无数的 Google 搜索让我没有答案:-(

最佳答案

发布时,底层主机 (Azure) 将重新启动。 您可以使用 CancellationToken 作为参数,以便在发生这种情况时收到信号并停止您的工作或取消对外部服务的等待。

    public async static Task Run([TimerTrigger("*/10 * * * * *")]TimerInfo myTimer, CancellationToken token)
    {
      // some function code...
    }

您可以在这篇文章中找到更详细的示例: CancellationToken doesn't get triggered in the Azure Functions

关于c# - 发布新版本时,正在运行的 Azure Function 是否完成或终止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53009587/

相关文章:

c# - 我应该如何在我的 ViewModel 中加载一个具有子集合属性的实体?

c# - 如何使用 XmlSerializer 在大型文档中插入节点

c# - 如何找到 vswhere 的 exe 路径?

c# - 禁用 Windows 窗体 Web 浏览器中的提示

azure - 有 Azure Function Reminder Trigger 这样的东西吗?

具有 Blob 存储的 Azure Functions。如何为子文件夹创建 BlobTrigger?

c# - 从 JavaScript 调用用户定义的函数

azure - 在本地运行 Azure Functions 时如何获取日志类别?

javascript - 在 azure 函数内发出 https 请求

asp.net-core - 尝试在 Azure 函数中使用依赖注入(inject)时出现奇怪的异常