简体   繁体   中英

System.Net.Sockets.SocketException in Visual Studio while using Azure

I am trying to send a message to an Event Hub from Visual Studio using C# and I get the below exception.

System.Net.Sockets.SocketException: 'No such host is known'

Any reason why?

Below is the code:

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();
        }

It seems like the connection to the connection string cannot be build, are you sure that the servers can see eachother (check the firewall settings on azure).

explaination of firewalls within azure: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure

Default port number: 1433

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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