An unhandled exception of type 'System.FormatException' occurred in Microsoft.Azure.Devices.dll

597 views Asked by At

I'm referring this tutorial to create a device identity. However, getting an exception as below:

enter image description here

Here is my config file:

enter image description here

Edit:
What is this Instrumentation key and value in App.Config? I just copied from the sample code. However, from where can I get it, in case I'm using a real device?

Am I missing any SDK or anything else? Do I need to download something extra? the tutorial does not suggest anything. Even when I'm running sample code from GiTHub getting the same error.

3

There are 3 answers

3
Roman Kiss On BEST ANSWER

the following screen snippet shows a reason of this error, such as connectionString.

Error

Use the connectionString from your Azure IoT Hub - see the tutorial section Create an IoT Hub step 6.

0
Dominic Betts On

Can you check that the connection string you're using is in the correct format. It should look like:

"HostName={your hub name}.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey={your key}"

You can copy the complete connection string from the portal as described in the tutorial.

0
AskMe On

Issue resolve: I was missing my connection string.Which I got from "IoTHubOwner" from Azure portal login. :)