首页 > 解决方案 > 无法在 Azure Edge 中执行模块到模块的通信

问题描述

我试图在 Azure 边缘实现从 c# 模块到 python 模块的模块到模块通信,

Using Ubuntu as OS 
Edge Runtime: 1.0.8 
EdgeAgent 1.0.10 
EdgeHub 1.0.10

发送数据的 C# 代码

        {
            Console.WriteLine($"Received message: [{cloudtoDeviceMessages}]"); // cloudtoDeviceMessages is a string 

            await moduleClient.SendEventAsync("serialmoduleoutput", new Message(Encoding.UTF8.GetBytes(cloudtoDeviceMessages)));

            Console.WriteLine("Sent The Method Body To Serial Module");

部署文件中的路由,我也有其他模块路由,但只给出相关的

Fromc2dcommunicationmoduleToTestModule": "FROM /messages/modules/c2dcommunicationmodule/outputs/serialmoduleoutput INTO BrokeredEndpoint(\"/modules/TestModule/inputs/input1\")",

Python 代码:与此 GitHub 示例相同https://github.com/Azure/azure-iot-sdk-python/blob/master/azure-iot-device/samples/sync-samples/receive_message_on_input.py

在 C# 代码中我没有得到任何异常,但是在 python 模块中我也没有得到任何数据。

标签: pythonc#azureazure-iot-edgeazure-iot-sdk

解决方案


该问题已通过更新 require.txt 文件中的 azure-iot-device 包得到解决,默认情况下,在创建模块时它会安装 2.0.0 版本的包,但最新版本是 2.8。在最新版本中,通信工作正常。


推荐阅读