gpt4 book ai didi

c# - 来自 Visual Studio 2017 的 Azure 函数调试连接出现 'N/A' 监听器连接错误

转载 作者:行者123 更新时间:2023-12-03 04:23:01 30 4
gpt4 key购买 nike

我在 Visual Studio 2017(包含最新更新)中启动一个新项目并创建一个 Azure Function。我将存储帐户添加到 local.settings.json 中,并将存储帐户的连接字符串粘贴到 AzureWebJobsStorage 中。

[FunctionName("Function1")]
public static void Run([EventHubTrigger("wms-events", Connection = "ConnectionStringTest1")]string myEventHubMessage, TraceWriter log)
{
log.Info($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
}

The listener for function 'Function1' was unable to start. Microsoft.ServiceBuss: An error occurred during communication with 'N/A'. Check the connection information, then retry. System: An existing connection was forcibly closed by the remote host.

为什么是“不适用”?我会假设这是 WebStorage 连接,并且我知道这是一个合法的连接字符串。

enter image description here

连接字符串示例(已混淆)

{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=stuff;AccountKey=UCIdr7FscQQIJhRkJ4rsstuffstuffstuffzKwRZ1QG4EC9bIhJx+x11CVg9dd1AElMBUkw==;EndpointSuffix=core.windows.net",
"AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=stuffstuffstuff;AccountKey=UCIdr7FscQQIJhRkstuffstuffstuff3/zZ5FyGJ3MdzKwRZ1QG4EC9bIhJx+x11CVg9dd1AElMBUkw==;EndpointSuffix=core.windows.net",
"ConnectionStringTest1": "Endpoint=sb://stuffstuffstuff.servicebus.windows.net/;SharedAccessKeyName=AzureFunction;SharedAccessKey=SVfahzJQE5ustuffstuffstuff1zrgAOUPI+yfp63pRA=;EntityPath=stuffstuffstuff"
}
}

最佳答案

你是如何获得ConnectionStringTest1的?它应该是 eventhub 连接字符串(不是服务总线)。您可以使用门户上的共享访问策略获取 Evenhub 命名空间或 eventhub 级别的连接字符串:

https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-create

关于c# - 来自 Visual Studio 2017 的 Azure 函数调试连接出现 'N/A' 监听器连接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46810348/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com