c# - 使用.Net创建azure IOT集线器设备

标签 c# azure-iot-hub

我想为客户创建 IOT 中心。我已经使用 REST API 创建了 IOT Hub,但无法找到在其中创 build 备的方法。我正在使用 Rest API 创建 IOT 中心。它被创建但是当我尝试创 build 备时,我遇到了未经授权的异常。我正在使用this api .

最佳答案

使用RegistryManager来自 SDK Microsoft.Azure.Devices以及 Azure 门户中“共享访问策略”选项卡中的连接字符串 registry write :

var registryManager = RegistryManager.CreateFromConnectionString(connectionString);
var device = new Microsoft.Azure.Devices.Device(name);
var deviceWithKeys = await registryManager.AddDeviceAsync(device);

关于c# - 使用.Net创建azure IOT集线器设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50271159/

相关文章:

c# - 非 Win Form C# 应用程序中的同步事件处理程序线程执行

c# - 注册(许可)您自己的组件有多重要?

c# - .net 中使用的所有语言都具有相同的性能吗?

c# - 当 AutoPostBack = true 时防止在 AJAX TabContainer 上重新加载页面?

c# - ServiceClient (Microsoft.Azure.Devices) OpenAsync 问题

json - 微软 azure 物联网中心: Decode a message from base64 format to 8-utf in message route query

c# - 行为 View 模型绑定(bind)

python - X509 对象不检查我在 Azure IoT 中心设备中创建自己的 CA 签名证书时设置的密码

c# - 'Microsoft.Azure.Devices.Client'中的ReceiveAsync方法是否消耗互联网?

azure - ESP8266 未连接到 Azure Iot Hub,返回状态 -2