Azure OPC发行商说;“未收到任何工作”;尝试将OPC UA数据写入云时
我正在努力学习这些教程: 及 将数据从opc ua服务器传送到azure云 我已经成功地完成了教程 我想可能OPCPublisher找不到配置文件 我在C:\iiotedge\pn.json下设置了配置文件(ip已更改): 容器创建选项如下所示:Azure OPC发行商说;“未收到任何工作”;尝试将OPC UA数据写入云时,azure,azure-iot-hub,opc-ua,azure-iot-edge,Azure,Azure Iot Hub,Opc Ua,Azure Iot Edge,我正在努力学习这些教程: 及 将数据从opc ua服务器传送到azure云 我已经成功地完成了教程 我想可能OPCPublisher找不到配置文件 我在C:\iiotedge\pn.json下设置了配置文件(ip已更改): 容器创建选项如下所示: { "Hostname": "publisher", "Cmd": [ "publisher", "--ll=debug", "--pf=./pn.json", "--di=60", "--to",
{
"Hostname": "publisher",
"Cmd": [
"publisher",
"--ll=debug",
"--pf=./pn.json",
"--di=60",
"--to",
"--aa",
"--si",
"0",
"--ms",
"0"
],
"HostConfig": {
"PortBindings": {
"62222/tcp": [
{
"HostPort": "62222"
}
]
},
"ExtraHosts": [
"localhost:127.0.0.1"
],
"Binds": [
"c:/iiotedge:c:/appdata"
]
}
}
opc publisher的日志输出为:
PS C:\Users\azureuser> iotedge logs OPCPublisher
[06:02:52 INF] Connecting all clients to edgevm using MqttOverTcp. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 DBG] Starting Module Host... (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:53 WRN] Bypassing certificate validation for client. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 INF] Running in iotedge context. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:53 DBG] [Info] Informational: IotHubConnectionString#50048984 .ctor IAuthenticationMethod is AuthenticationWithTokenRefresh: ModuleAuthenticationWithHsm#5560998 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ITransportSettings[] = Microsoft.Azure.Devices.Client.ITransportSettings[1] (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set IotHubConnectionString = IotHubConnectionString#50048984 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set OnMethodCalledDelegate = OnMethodCalledDelegate#1525631264 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set Action`1 = System.Action`1[Microsoft.Azure.Devices.Shared.TwinCollection] (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ConnectionStatusChangesHandler = ConnectionStatusChangesHandler#1558992671 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set OnReceiveEventMessageCalledDelegate = OnReceiveEventMessageCalledDelegate#1523701015 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ProductInfo = .NET/1.24.0 (.NET Core 3.1.3; Microsoft Windows 10.0.17763 WindowsProduct:0x00000030; X64; 176FF90A-591F-574A-86D3-34024A506733) (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [CreateFromConnectionString] Informational: InternalClient#45596481 HostName=edgevm;DeviceId=myEdgeDevice;ModuleId=OPCPublisher Mqtt_Tcp_Only (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: InternalClient#45596481 SetConnectionStatusChangesHandler ConnectionStatusChangesHandler#1809274109 (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: RetryDelegatingHandler#39070558 EnsureOpenedAsync Opening connection (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: ProtocolRoutingDelegatingHandler#36936550 ProtocolRoutingDelegatingHandler.OpenAsync Trying Mqtt_Tcp_Only (Microsoft.Azure.Devices.Device.Client)
[06:02:53 DBG] [Info] Informational: PipelineContext#2327487 Set ITransportSettings = MqttTransportSettings#12674872 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [Info] Informational: (null) GetEventLoopGroup EventLoopGroup threads count was not set. (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [Info] Informational: MqttTransportHandler#46964992 CreateChannelFactory Connecting to 172.23.40.21 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] [GenerateToken] Informational: ModuleAuthenticationWithHsm#5560998 2020-05-22T06:02:54.4013728Z 2020-05-22T07:02:54.0000000Z (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] 0: Module myEdgeDevice_OPCPublisher reconnected due to Connection_Ok. (Microsoft.Azure.IIoT.Module.Framework.Client.IoTSdkFactory)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/GET/?$rid=71fb2065-fb60-41e3-b4a5-c15d95292cd1 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] Initialize device twin for myEdgeDevice - OPCPublisher (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Applying initial desired state. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Reporting currently initial state. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] Reporting controller state... (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/PATCH/properties/reported/?$rid=b536d6e8-9ae0-4245-86a2-53e2688e4c06 (Microsoft.Azure.Devices.Device.Client)
[06:02:54 DBG] Complete controller state reported (properties: ["JobCheckInterval", "HeartbeatInterval", "MaxWorkers", "IdentityToken"]). (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 DBG] [Info] Informational: MqttIotHubAdapter#14347911 SendMessageAsync id=0 qos=AtMostOnce topic=$iothub/twin/PATCH/properties/reported/?$rid=b7d3c2a6-1daa-4431-8448-10430c29ab8f (Microsoft.Azure.Devices.Device.Client)
[06:02:54 INF] Module Host started. (Microsoft.Azure.IIoT.Module.Framework.Hosting.ModuleHost)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Creating new worker... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_0'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_0 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_1'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_1 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_2'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_2 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_3'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_3 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Starting worker 'myEdgeDevice_OPCPublisher_4'... (Microsoft.Azure.IIoT.Agent.Framework.Agent.WorkerSupervisor)
[06:02:54 INF] Worker WorkerId: myEdgeDevice_OPCPublisher_4 {"Type": "publisher", "SiteId": "myEdgeDevice", "DeviceId": "myEdgeDevice", "ModuleId": "OPCPublisher"} (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Worker starting... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Try querying available job... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 INF] Worker: myEdgeDevice_OPCPublisher_4, no job received, wait 00:00:05 ... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Sending heartbeat... (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
[06:02:54 DBG] Could not send worker heartbeat. (Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker)
Microsoft.Azure.IIoT.Exceptions.InvalidConfigurationException: Job orchestrator not configured
at Microsoft.Azure.IIoT.Api.Jobs.Clients.JobOrchestratorClient.SendHeartbeatAsync(HeartbeatModel heartbeat, CancellationToken ct) in D:\a\1\s\api\src\Microsoft.Azure.IIoT.Api.Edge\src\Jobs\Clients\JobOrchestratorClient.cs:line 69
at Microsoft.Azure.IIoT.Agent.Framework.Agent.Worker.HeartbeatTimer_ElapsedAsync(Object sender) in D:\a\1\s\common\src\Microsoft.Azure.IIoT.Agent.Framework\src\Agent\Default\Worker.cs:line 147
(编辑以显示日志级调试)
我希望在日志中读到一些与OPC UA相关的东西,但事实并非如此。工作人员似乎无法向作业协调器发送心跳信号?也面临同样的问题。看起来容器不是在
appdata
中运行,而是在app
中运行。我已将createOptions更改为:
{
"Hostname": "publisher",
"Cmd": [
"publisher",
"--pf=C:/appdata/pn.json",
"--di=60",
"--to",
"--aa",
"--si=0",
"--ms=0"
],
"ExposedPorts": {
"62222/tcp": {}
},
"HostConfig": {
"Dns": [
"1.1.1.1"
],
"Binds": [
"c:/iotedge:c:/appdata"
],
"PortBindings": {
"62222/tcp": [
{
"HostPort": "62222"
}
]
}
}
}
面对完全相同的问题,您找到解决方案了吗?我通过提供
pn.json
:--pf=C:/appdata/pn.json
的完整路径,成功地解决了这个问题。应用程序的根目录似乎已更改为app
,而不是appdata
。
{
"Hostname": "publisher",
"Cmd": [
"publisher",
"--pf=C:/appdata/pn.json",
"--di=60",
"--to",
"--aa",
"--si=0",
"--ms=0"
],
"ExposedPorts": {
"62222/tcp": {}
},
"HostConfig": {
"Dns": [
"1.1.1.1"
],
"Binds": [
"c:/iotedge:c:/appdata"
],
"PortBindings": {
"62222/tcp": [
{
"HostPort": "62222"
}
]
}
}
}