Forum Discussion

Ramesh Krishnamurthy's avatar
Ramesh Krishnamurthy
Copper Contributor
Jun 02, 2017

Connect your simulated device to your IoT hub using .NET

I went through the Microsoft tutorial "Getting Started with Azure IoT Hub"

link - https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-csharp-csharp-getstarted

 

At runtime it gives the error - 

Microsoft.ServiceBus.Messaging.MessagingCommunicationException occurred
HResult=0x80131500
Message=An error occurred during communication with 'DeviceGateway_c55eb685be2644918785348b055d9c5a:ihsuprodblres058dednamespace.servicebus.windows.net:5671'. Check the connection information, then retry.
Source=Microsoft.ServiceBus
StackTrace:
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.RunSynchronously()
at Microsoft.ServiceBus.Messaging.Amqp.AmqpEventHubClient.GetRuntimeInformation()
at ReadDeviceToCloudMessages.Program.Main(String[] args) in E:\IoThub\IotHubGetStarted\ReadDeviceToCloudMessages\Program.cs:line 34

Inner Exception 1:
SocketException: 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

 

I am attaching screenshot of the exact position of error.

Please suggest a solution.

 

Thank you

6 Replies

    • Ramesh Krishnamurthy's avatar
      Ramesh Krishnamurthy
      Copper Contributor

      Hi,

       

      Thanks for the help. The issue is resolved.

      Now I am trying to save the data from the previous tutorial to the azure storage account following the tutorial - https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-store-data-in-azure-table-storage

       

      Running the code "index.js" (refer to the above link) separately saves the message, but the messages from my simulated device are received but not being saved.

      What do you  think can be the reason? What am I doing wrong?

      Following is the screenshot of Azure storage explorer.

       

      Thanks

      • Shameera Prajapriya's avatar
        Shameera Prajapriya
        MVP

        Hi,

         

        I am giving you quick suggession till i check this. Please share a screenshot of your code.

         

        My Suggession is use Stream Analytics without code. Please follow the quick steps here you will be able to search and find tutorials in web.

         

        01. Create a Stream Analytics

        02. Select your IoT Hub as the Input

        03. You can choose blob / sql or PowerBi,

        04, Write a function query , as what you want to output as a example you can say SELECT * means all the inputs comming from IoT Hub to your OutPut.

        05. By this way you can avoid unnecessary data comming through your Hub.

         

        This is a qucik reply to give you an idea,

         

        Best Regards,

         

        Shameera

         

         

         

Resources