Wednesday, April 18, 2018

Dot Net Core Preview Tool 3 Missing Issue with yeoman asp core generator with VS 2017 Sample Project

If you have installed VS 2017 RC previously and upgraded to VS 2017 Community version and when you are working with the sample which provided by yeoman asp core generator,you might see this error occurred,



Previously There was separate .NET Core SDK preview tool installation but now it is missing with their web sites.

To build the VS 2017 project with preview tool 3 you need to visit this url and download

.NET Core 1.0.0 SDK – Preview 3-004056




Saturday, April 14, 2018

Azure IoT Getting Started

Hello after a long time.. Today will have a quick post with Azure IoT.

Internet of Things going in Enterprise level and we have to get ready for the upcoming challenges in large scale. To prepare with it let's begin with Azure IoT.

In this article I am going to do the practice of simulating a IoT device and communicate with Azure IoT Hub (Uses MQTT Protocol).

First of all we need to have a Azure account created and enable a free tier subscription or if you already have a that's better.


1. Goto https://portal.azure.com 

2. Search and create the IoT hub






3.It will take several minutes to complete the Azure IoT Hub creation.Once it compete you can navigate inside to it.You need to get some important names and keys from the overview section and  shared policies section.

Overview 



Then select shared access policies and click on the iothubowner row inorder show the keys and connection strings.

Shared access policies




4.Next step is to integrate with the devices.To do that we have to simulate a device from the code. Here I am using a .net console applications to work as a device. You can download the given sample project from github or just run the command if you have git bash.

git clone https://github.com/Azure-Samples/iot-hub-dotnet-simulated-device-client-app.git


5.Once you get the clone you can open the solution in Visual Studio.There are 3 main console applications
       i.Create Device Identity - Add the simulated device to IoT Hub
       ii.Read Device to Cloud Messages - Read the messages sent from the IoT Hub
       iii.Simulated Device - Sending messages to the IoT Hub



Just add the all related parameters with correct values which are represented in IoT Hub.

6.Set the Create Device Identity project as startup and run it (Add the correct values for properties).



Once you run the application you will see a device key in the console.Note it down and add that key into the Simulated Device project program.cs DeviceId property.



Also check in the Azure portal, it will show up the added device.



Now it's time to get the messages from cloud and send the messages from the device.

Set the required properties as the correct values and run the project Read Device To Cloud Messages.




Sending a message to the device from the IoT Hub


You will receive the messages sent from the IoT hub you can see all the messages in the console.

7. Run Device to Cloud Console application and run a message from the IoT hub using Message to Device option.



8.Finally run the Simulated Device Console application to send the data to IoT hub.


You can see set of messges received from the azure portal IoT hub.



That's all for today with a quick go through .See you next time with an advanced article.

(References - Azure documentation for IoT Hub with .NET (https://docs.microsoft.com/en-us/azure/iot-hub/))