问题 运行 事件中心在本地触发 azure 函数,启动时出现 "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 函数,几天前我测试过它并且工作正常但由于某些未知原因它 returns 一个错误
函数设置为:
[FunctionName("EventUpdatedHubFunction")]
public async Task Run([EventHubTrigger(
"%EventConsumer:Name%",
ConsumerGroup = "%EventConsumer:ConsumerGroup%",
Connection = "EventConsumer:ConnectionString")]
EventData[] events)
{
// logic
}
我在 运行 调用该函数时遇到的错误是:
[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 函数解决方案(在这种情况下它确实有效)。
所以在这一点上我不知道是什么导致了这个问题。
解决方案是:通过Azure Storage Explorer,在Local & Attached
下找到(Emulator - Default Ports)/Blob Containers/azure-webjobs-eventhub
容器并删除其中的所有内容以释放space。
目前我已经设置了以下简单的 azure azure 函数,几天前我测试过它并且工作正常但由于某些未知原因它 returns 一个错误
函数设置为:
[FunctionName("EventUpdatedHubFunction")]
public async Task Run([EventHubTrigger(
"%EventConsumer:Name%",
ConsumerGroup = "%EventConsumer:ConsumerGroup%",
Connection = "EventConsumer:ConnectionString")]
EventData[] events)
{
// logic
}
我在 运行 调用该函数时遇到的错误是:
[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 函数解决方案(在这种情况下它确实有效)。
所以在这一点上我不知道是什么导致了这个问题。
解决方案是:通过Azure Storage Explorer,在Local & Attached
下找到(Emulator - Default Ports)/Blob Containers/azure-webjobs-eventhub
容器并删除其中的所有内容以释放space。