This "Getting Started" document shows you how to build and run the Device Client AMQP Sample application on the Windows platform.
Before you get started, you should:
- Prepare your development environment.
- Setup your IoT Hub
- Configure your device in IoT Hub.
See the section "Configure IoT Hub connection" in the document How to use Device Explorer.
-
Start a new instance of Visual Studio 2015. Open the iothub_csharp_client.sln solution in the csharp\device folder in your local copy of the repository.
-
In Visual Studio, in Solution Explorer, navigate to the samples folder. In the DeviceClientAmqpSample project, open the Program.cs file.
-
Locate the following code in the file:
private const string DeviceConnectionString = "<replace>";
-
Replace
<replace>
with the connection string for your device. The section "Get device connection string or data" in the document How to use Device Explorer explains how to retrieve the connection string for your device. Save the changes. -
The section "Send events" in the document How to use Device Explorer describes how to prepare the DeviceExplorer tool to receive device-to-cloud messages from the sample application.
-
In Solution Explorer, right-click the DeviceClientAmqpSample project, click Debug, and then click Start new instance to build and run the sample. The console displays messages as the application sends device-to-cloud messages to IoT Hub.
-
Use the DeviceExplorer utility to observe the messages IoT Hub receives from the Device Client AMQP Sample application.
-
See the section "Send cloud-to-device messages" in the document How to use Device Explorer to learn how to use the DeviceExplorer utility to send cloud-to-device messages to the Device Client AMQP Sample application.