deviceClient在当前上下文中不存在

时间:2018-11-23 10:28:23

标签: azure-iot-hub

我正在测试Microsoft提供的示例以评估IoT中心,我在从云接收消息的方法上遇到问题

private static async void ReceiveC2dAsync()         {             
  Console.WriteLine("\nReceiving cloud to device messages from service");             
  while (true)             
  {                 
    Message receivedMessage = await deviceClient.ReceiveAsync();                 
    if (receivedMessage == null) continue;  

    Console.ForegroundColor = ConsoleColor.Yellow;                 
    Console.WriteLine("Received message: {0}", 
Encoding.ASCII.GetString(receivedMessage.GetBytes()));                 
    Console.ResetColor();                  
    await deviceClient.CompleteAsync(receivedMessage);             
  }         
} 

我收到此错误: CS0103名称“ deviceClient”在当前上下文中不存在

0 个答案:

没有答案