title: unable to connect to azure event hub from corpnet network
body: <p>I’m working on Azure Event Hub. I have an issue when connecting to azure event hub when I’m connected to corpnet network. If I run the code without joining corpnet network it works fine.
  Telnet test against the event hub looks good when I’m connected to corpnet network. </p>
  
  <p>Any idea how to resolve this?</p>
  
  <p>Below is the code, error message and stack trace.</p>
  
  <p><strong>Code</strong>:</p>
  
  <pre><code>            public async Task SendDataAsync(CoffeeMachineData data)
              {
                  EventData eventData = CreateEventData(data);
                  await _eventHubClient.SendAsync(eventData);
              }
  
  
  
              private static EventData CreateEventData(CoffeeMachineData data)
              {
                  var dataAsJson = JsonConvert.SerializeObject(data);
                  var eventData = new EventData(Encoding.UTF8.GetBytes(dataAsJson));
                  return eventData;
              }
  </code></pre>
  
  <p><strong>Error Message</strong>:</p>
  
  <pre><code>            A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
  </code></pre>
  
  <p><strong>Stack Trace</strong>:</p>
  
  <pre><code>           at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
             at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
             at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
             at Microsoft.Azure.Amqp.Transport.TlsTransport.HandleOpenComplete(IAsyncResult result, Boolean syncComplete)
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
             at Microsoft.Azure.Amqp.ExceptionDispatcher.Throw(Exception exception)
             at Microsoft.Azure.Amqp.AsyncResult.End[TAsyncResult](IAsyncResult result)
             at Microsoft.Azure.Amqp.AmqpObject.OpenAsyncResult.End(IAsyncResult result)
             at Microsoft.Azure.Amqp.AmqpObject.EndOpen(IAsyncResult result)
             at Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.HandleTransportOpened(IAsyncResult result)
             at Microsoft.Azure.Amqp.Transport.TlsTransportInitiator.OnTransportOpened(IAsyncResult result)
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at Microsoft.Azure.EventHubs.Amqp.AmqpEventHubClient.&lt;CreateConnectionAsync&gt;d__31.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
             at Microsoft.Azure.Amqp.FaultTolerantAmqpObject`1.&lt;OnCreateAsync&gt;d__5.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
             at Microsoft.Azure.Amqp.Singleton`1.&lt;CreateValue&gt;d__20.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
             at Microsoft.Azure.Amqp.Singleton`1.&lt;GetOrCreateAsync&gt;d__13.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
             at Microsoft.Azure.EventHubs.Amqp.AmqpEventDataSender.&lt;CreateLinkAsync&gt;d__12.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
             at Microsoft.Azure.Amqp.FaultTolerantAmqpObject`1.&lt;OnCreateAsync&gt;d__5.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
             at Microsoft.Azure.Amqp.Singleton`1.&lt;CreateValue&gt;d__20.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
             at Microsoft.Azure.Amqp.Singleton`1.&lt;GetOrCreateAsync&gt;d__13.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at Microsoft.Azure.EventHubs.Amqp.AmqpEventDataSender.&lt;OnSendAsync&gt;d__10.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
             at Microsoft.Azure.EventHubs.Amqp.AmqpEventDataSender.&lt;OnSendAsync&gt;d__10.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at Microsoft.Azure.EventHubs.EventHubClient.&lt;SendAsync&gt;d__19.MoveNext()
          --- End of stack trace from previous location where exception was thrown ---
             at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
             at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
  </code></pre>