繁体   English   中英

function 'Function1' 的侦听器在运行计时器时无法启动 function

[英]The listener for function 'Function1' was unable to start when running a timer function

当我在 Azure Cloud 中运行我的计时器 function 应用程序时,出现以下错误。 这只是一个基本代码,我希望日志显示在 Insight 中。

异常信息

public static class Function1
{
    [FunctionName("Function1")]
    public static void Run([TimerTrigger("0 * * * * *")]TimerInfo myTimer, ILogger log)
    {
        log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
    }
}

在此处输入图像描述

在此处输入图像描述

这是我为确定此问题原因所做的解决方法:

  1. Created the Azure Function (Stack: .NET 3.1) of type Timer Trigger with your given timer "0 * * * * *" and the connection string given from the storage account created in Azure portal, which is running successfully (in local):

在此处输入图像描述

2. 从 Azure 门户中删除了存储帐户,并尝试在本地运行 function,这给了我错误: The listener for function Function1 was unable to start.

在此处输入图像描述

恢复存储帐户,然后部署到 Azure 门户 Function App 并在云中成功运行:

在此处输入图像描述

在 Azure 云中,是的,正如@Skin所说,这将是一个存储帐户配置问题。

解决此问题的几个步骤是:

  • 检查AzureWebJobsStorage值是否包含正确的存储帐户连接字符串。
  • 检查存储帐户是否未删除。
  • 检查 Function 应用程序中的网络选项,可能是防火墙阻止/限制对关联存储帐户的访问。

这是一个防火墙问题。 在存储帐户 > 网络 > 防火墙和虚拟网络下添加了适当的虚拟网络和 Su.net

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM