System.Net.Sockets.SocketException 在 Visual Studio 使用 Azure
System.Net.Sockets.SocketException in Visual Studio while using Azure
我正在尝试使用 C# 从 Visual Studio 向事件中心发送消息,但出现以下异常。
System.Net.Sockets.SocketException: 'No such host is known'
有什么原因吗?
代码如下:
namespace EventGenerator
{
using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.EventHubs;
public class Program
{
private static EventHubClient eventHubClient;
private const string EhConnectionString = "{EHCONNECTIONSTRING}";
private const string EhEntityPath = "{EVENTHUBNAME}";
public static void Main(string[] args)
{
MainAsync(args).GetAwaiter().GetResult();
}
似乎无法建立与连接字符串的连接,您确定服务器可以相互看到吗(检查 azure 上的防火墙设置)。
azure 中的防火墙说明:https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure
默认端口号:1433
我正在尝试使用 C# 从 Visual Studio 向事件中心发送消息,但出现以下异常。
System.Net.Sockets.SocketException: 'No such host is known'
有什么原因吗?
代码如下:
namespace EventGenerator
{
using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.EventHubs;
public class Program
{
private static EventHubClient eventHubClient;
private const string EhConnectionString = "{EHCONNECTIONSTRING}";
private const string EhEntityPath = "{EVENTHUBNAME}";
public static void Main(string[] args)
{
MainAsync(args).GetAwaiter().GetResult();
}
似乎无法建立与连接字符串的连接,您确定服务器可以相互看到吗(检查 azure 上的防火墙设置)。
azure 中的防火墙说明:https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure
默认端口号:1433