简体   繁体   English

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

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

I am getting this below error when I am running my timer function app in Azure Cloud.当我在 Azure Cloud 中运行我的计时器 function 应用程序时,出现以下错误。 It is just a basic code and I wanted the log to be shown in Insight.这只是一个基本代码,我希望日志显示在 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}");
    }
}

在此处输入图像描述

在此处输入图像描述

Here is the workaround I did to identify this issue cause:这是我为确定此问题原因所做的解决方法:

  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): 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. Deleted the Storage account from the Azure Portal and tried to run the function locally which gave me the error: The listener for function Function1 was unable to start. 2. 从 Azure 门户中删除了存储帐户,并尝试在本地运行 function,这给了我错误: The listener for function Function1 was unable to start.

在此处输入图像描述

Recovered the Storage Account and then deployed to the Azure Portal Function App and running successfully in cloud also:恢复存储帐户,然后部署到 Azure 门户 Function App 并在云中成功运行:

在此处输入图像描述

In the Azure Cloud, Yes, as @Skin Said that it would be a Storage Account configuration issue.在 Azure 云中,是的,正如@Skin所说,这将是一个存储帐户配置问题。

Few of the steps to resolve this issue were:解决此问题的几个步骤是:

  • Check the AzureWebJobsStorage value contains correct the correct storage account connection string.检查AzureWebJobsStorage值是否包含正确的存储帐户连接字符串。
  • Check the Storage account is not deleted.检查存储帐户是否未删除。
  • Check the Networking Option in the Function App that might be the firewall is blocking/restricting the access to the associated storage account.检查 Function 应用程序中的网络选项,可能是防火墙阻止/限制对关联存储帐户的访问。

It was a firewall issue.这是一个防火墙问题。 Added the appropriate Virtual Network and Su.net under Storage Account > Networking > Firewalls and Virtual Network在存储帐户 > 网络 > 防火墙和虚拟网络下添加了适当的虚拟网络和 Su.net

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

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