Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » X509 Authentication with IoT Hub & C#
X509 Authentication with IoT Hub & C# [message #1765713] Tue, 13 June 2017 17:23
Todd Benning is currently offline Todd BenningFriend
Messages: 2
Registered: June 2017
Junior Member
I'm trying the following code, but no messages are ever posted to IoT Hub
var deviceId = "2c8540ee-85df-4f1a-b35f-00124e1d3c4a";

var caCert = new X509Certificate2("c:\\certs\\iothub_ca.crt");   // From https://github.com/Azure/azure-iot-sdk-c/blob/master/certs/certs.c
var clientCert = new X509Certificate2("C:\\certs\\device.pfx");

var client = new MqttClient(
    "my-iot-hub.azure-devices.net", 
    MqttSettings.MQTT_BROKER_DEFAULT_SSL_PORT, true,
    caCert,
    clientCert,
    MqttSslProtocols.TLSv1_2);
    
client.Connect(deviceId);

client.Publish($"devices/{deviceId}/messages/events/", Encoding.UTF8.GetBytes("Hello"));


I've verified that my device.pfx file works with the IoT Hub Device SDK, but nothing I try with MqttClient is working.

Additionally, there appears to be some sort of resource leak because my cpu creeps up every time I call client.Publish, but never comes back down.

[Updated on: Tue, 13 June 2017 21:37]

Report message to a moderator

Previous Topic:Delete me
Next Topic:Python Example and documentation out of date
Goto Forum:
  


Current Time: Thu Apr 18 13:01:56 GMT 2024

Powered by FUDForum. Page generated in 0.01975 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top