简体   繁体   English

来自Visual Studio 2017的Azure Function调试连接获取'N / A'侦听器连接错误

[英]Azure Function debug connection from Visual Studio 2017 getting a 'N/A' listener connection error

I start a new project in Visual Studio 2017 (with the latest updates) and create a Azure Function. 我在Visual Studio 2017中启动了一个新项目(具有最新更新),并创建了一个Azure函数。 I added the storage account to both the local.settings.json and paste in the connection string from for the Storage account into AzureWebJobsStorage. 我将存储帐户添加到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. 函数“ Function1”的侦听器无法启动。 Microsoft.ServiceBuss: An error occurred during communication with 'N/A'. Microsoft.ServiceBuss:与“ N / A”通信时发生错误。 Check the connection information, then retry. 检查连接信息,然后重试。 System: An existing connection was forcibly closed by the remote host. 系统:现有连接被远程主机强行关闭。

Why 'N/A'? 为什么选择“不适用”? I would have assumed that was the WebStorage connection and I know that is a legit connection string. 我以为那是WebStorage连接,我知道这是合法的连接字符串。

在此处输入图片说明

Connection string example (obfuscated) 连接字符串示例(混淆)

{
  "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"
  }
}

How did you get ConnectionStringTest1? 您是如何获得ConnectionStringTest1的? It should be eventhub connection string(not service bus). 它应该是eventhub连接字符串(不是服务总线)。 You can get connection string on evenhub namespace or eventhub level using Shared Access Policies on the portal: 您可以使用门户网站上的共享访问策略在evenhub名称空间或eventhub级别上获取连接字符串:

https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create https://docs.microsoft.com/zh-CN/azure/event-hubs/event-hubs-create

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

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