与Azure IoT中心的连接断开

时间:2020-06-15 08:16:13

标签: azure mqtt node-red azure-iot-hub

我在Raspberry Pi上安装了Node-RED。

使用Node-RED使用Mosquitto连接到Azure IoT中心。

有时会遇到麻烦,因为与Azure IoT中心的连接丢失了。

使用Log Analytics检查时,出现以下错误。

<ERROR>
This article describes the causes and solutions for 404104 DeviceConnectionClosedRemotely errors.

原因是完全未知的,即使在调查了对策之后,我仍然找不到它。

enter image description here

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

我建议更长的时间生成SAS令牌。

更新


@Rio正在提交用户声音,请导航至When the connection of Azure IoT Hub from Node-RED is disconnected, an error occurs and it cannot be reconnected,并对支持此功能的要求进行投票和评论。


您必须在Node-Red中重新创建并重新配置令牌 到期。请参阅Connect Node-Red to Azure IoT Edge

**通过Azure CLI:az iot hub generate-sas-token

通过使用@JD Allen注释的代码,或使用如下所示的c#,

要基本了解如何基于SharedAccessKey刷新SAS令牌,请参阅此C#代码段。请确保您还具有IoTHub连接字符串和deviceId。有关更多信息,请参阅azure-iot-sdk-csharp

$factory = (new Factory)->withServiceAccount(__DIR__.'/google-service-account.json');

$database = $factory->createDatabase();

**还请参阅Protocol specifics文档。

Azure IoT SDK s在连接到时会自动生成令牌 服务。在某些情况下,Azure IoT SDK不支持所有 协议或所有身份验证方法。

**还请参阅类似的GitHub问题sas token renewal#613Renew SAS token used by Azure Iot Hub DeviceClient #1127

相关问题