当前从 Azure 门户调用直接方法是否存在问题?
Is there currently an issue calling direct methods from Azure portal?
为了简单测试,我在quickstart之后创建了一个Linux设备。
然后我尝试通过 Azure 门户 tempSensor 模块调用 "reset" 直接方法。我收到以下错误:
Failed to invoke device method: {"message":"Device {\"Message\":\"{\\"errorCode\\":404103,\\"trackingId\\":\\"cc24992d14d44a498e65d1430907066c-G:2-TimeStamp:07/17/2018 16:52:44\\",\\"message\\":\\"Timed out waiting for device to connect.\\",\\"info\\":{\\"timeout\\":\\"00:00:10\\"},\\"timestampUtc\\":\\"2018-07-17T16:52:44.3400692Z\\"}\",\"ExceptionMessage\":\"\"} not registered"}
设备已连接并正在向 IoT 中心发送数据。
然后我用专有代码创建了第二个设备,但我也无法获得适用于模块的直接方法。
有些我不确定的事情可以提供答案:
- 是否需要从 $upstream 到接受直接方法的模块的路由?
- 门户调用模块的直接方法是否存在问题?
下面的代码是否仍然是在模块上调用直接方法的有效方式?
var serviceClient = ServiceClient.CreateFromConnectionString(connectionString);
var writeMessageMethod = new CloudToDeviceMethod("command");
serviceClient.InvokeDeviceMethodAsync(deviceId, moduleId, writeMessageMethod).Wait();
目前,
invoking direct methods using a module ID is supported in the C#
preview SDK. For this purpose, use the
ServiceClient.InvokeDeviceMethodAsync() method and pass in the
deviceId and moduleId as parameters.
引用“Method invocation for IoT Edge modules”
所以似乎不支持来自 Azure 门户。
Is there a route needed from $upstream to the module accepting a
direct method?
不需要。
Is there an issue in the portal calling direct methods to modules?
您需要从模块调用直接方法并使用上述C# 预览版SDK。所以从门户似乎还不支持。
Is the following code still a valid way to call a direct method on a
module?
var serviceClient = ServiceClient.CreateFromConnectionString(connectionString);
var writeMessageMethod = new CloudToDeviceMethod("command");
serviceClient.InvokeDeviceMethodAsync(deviceId, moduleId, writeMessageMethod).Wait();
是的,代码是正确的。但请注意,如果将直接方法命名为 "command",则需要调用 "command" 而不是 "reset".
引用“Azure IoT Edge V2 - Direct Method Invocation Sample (Linux only for now)”。
为了简单测试,我在quickstart之后创建了一个Linux设备。
然后我尝试通过 Azure 门户 tempSensor 模块调用 "reset" 直接方法。我收到以下错误:
Failed to invoke device method: {"message":"Device {\"Message\":\"{\\"errorCode\\":404103,\\"trackingId\\":\\"cc24992d14d44a498e65d1430907066c-G:2-TimeStamp:07/17/2018 16:52:44\\",\\"message\\":\\"Timed out waiting for device to connect.\\",\\"info\\":{\\"timeout\\":\\"00:00:10\\"},\\"timestampUtc\\":\\"2018-07-17T16:52:44.3400692Z\\"}\",\"ExceptionMessage\":\"\"} not registered"}
设备已连接并正在向 IoT 中心发送数据。
然后我用专有代码创建了第二个设备,但我也无法获得适用于模块的直接方法。
有些我不确定的事情可以提供答案:
- 是否需要从 $upstream 到接受直接方法的模块的路由?
- 门户调用模块的直接方法是否存在问题?
下面的代码是否仍然是在模块上调用直接方法的有效方式?
var serviceClient = ServiceClient.CreateFromConnectionString(connectionString); var writeMessageMethod = new CloudToDeviceMethod("command"); serviceClient.InvokeDeviceMethodAsync(deviceId, moduleId, writeMessageMethod).Wait();
目前,
invoking direct methods using a module ID is supported in the C# preview SDK. For this purpose, use the ServiceClient.InvokeDeviceMethodAsync() method and pass in the deviceId and moduleId as parameters.
引用“Method invocation for IoT Edge modules”
所以似乎不支持来自 Azure 门户。
Is there a route needed from $upstream to the module accepting a direct method?
不需要。
Is there an issue in the portal calling direct methods to modules?
您需要从模块调用直接方法并使用上述C# 预览版SDK。所以从门户似乎还不支持。
Is the following code still a valid way to call a direct method on a module?
var serviceClient = ServiceClient.CreateFromConnectionString(connectionString);
var writeMessageMethod = new CloudToDeviceMethod("command");
serviceClient.InvokeDeviceMethodAsync(deviceId, moduleId, writeMessageMethod).Wait();
是的,代码是正确的。但请注意,如果将直接方法命名为 "command",则需要调用 "command" 而不是 "reset".
引用“Azure IoT Edge V2 - Direct Method Invocation Sample (Linux only for now)”。