簡體   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