簡體   English   中英

運行事件中心的問題在本地觸發 azure function,啟動時出現“Out of retries creating lease for partition”錯誤

[英]Issues running event hub triggered azure function locally, getting "Out of retries creating lease for partition" error on startup

目前我已經設置了以下簡單的 azure azure function 我幾天前測試過並且工作正常但由於某些未知原因它返回錯誤

function 設置為:

    [FunctionName("EventUpdatedHubFunction")]
    public async Task Run([EventHubTrigger(
            "%EventConsumer:Name%",
            ConsumerGroup = "%EventConsumer:ConsumerGroup%",
            Connection = "EventConsumer:ConnectionString")]
        EventData[] events)
    {
        // logic
    }

我在運行 function 時遇到的錯誤是:

[2022-03-04T12:25:32.671Z] The listener for function 'EventUpdatedHubFunction' was unable to start.
[2022-03-04T12:27:09.897Z] The listener for function 'EventUpdatedHubFunction' was unable to start. Microsoft.Azure.EventHubs.Processor: Out of retries creating lease for partition 0. Microsoft.WindowsAzure.Storage: The response ended prematurely, with at least 157 additional bytes expected. System.Net.Http: The response ended prematurely, with at least 157 additional bytes expected.

這是我的配置文件(我沒有理由相信它是不正確的,因為它在過去有效):

{
    "IsEncrypted": false,
        "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet",
        "EventConsumer:Name": "event_consumer_name_test",
        "EventConsumer:ConsumerGroup": "consumer_group_test",
        "EventConsumer:ConnectionString": "Endpoint=.........",
        "Database:ConnectionString": "Server=.;Database=TestDatabase;Trusted_Connection=True;"
    }
}

到目前為止,我已經嘗試:

  • 在我的機器上刪除並重新安裝 Azure 存儲模擬器,
  • 刪除並重新創建 azure 模擬器數據庫,
  • 在另一台機器上運行 azure function 解決方案(在這種情況下它確實有效)。

所以在這一點上,我對可能導致問題的原因一無所知。

解決方案是:通過 Azure Storage Explorer,在Local & Attached下找到(Emulator - Default Ports)/Blob Containers/azure-webjobs-eventhub container 並刪除其中的所有內容以釋放空間。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM