no such host is known. (exception from hresult: 0x80072af9) exception when running azure device client on ARM device

0

I'm trying to run Microsoft Azure device client on Raspberrypi 3 device using below piece of code. when running it in local machine it is working fine, but if I deploy to my raspberry pi 3 device it is throwing "no such host is known. (exception from hresult: 0x80072af9)"

I have windows core IOT 10 os running on my raspberry pi device and using Visual studio 2017 for this sample project. I'm able to run sample apps like helloblinky on my raspberry pi.

    private static DeviceClient deviceClient = DeviceClient.Create("<myiothub>.azure-devices.net", new DeviceAuthenticationWithRegistrySymmetricKey(<deviceid>, "<secretkey>"), Microsoft.Azure.Devices.Client.TransportType.Amqp);

            while (true)
            {
                try
                {
                    receivedMessage = await deviceClient.ReceiveAsync();
                    if (receivedMessage != null)
                    {
                        messageData = Encoding.ASCII.GetString(receivedMessage.GetBytes());

                        await deviceClient.CompleteAsync(receivedMessage);
                        if (receivedMessage.Properties.ContainsKey("fans"))
                        {
                            GpioPinValue change = receivedMessage.Properties["fans"] == "true" ? GpioPinValue.High : GpioPinValue.Low;
                            pinValue = change;
                            pin.Write(pinValue);
                        }

                    }                 
                }
                catch(Exception ex)
                {

                }
            }
c#
azure
raspberry-pi3
windows-10-iot-core
azure-iot-hub
asked on Stack Overflow Jul 21, 2017 by user2801872 • edited Jul 21, 2017 by user2801872

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0