【问题标题】:C# Azure and IOT Reference to type 'stream' claims to be defined in 'System.RunTime', but it could not be foundC# Azure 和 IOT 对类型“流”的引用声称在“System.RunTime”中定义,但找不到
【发布时间】:2018-01-08 03:49:00
【问题描述】:

我正在尝试在以下网站上创建示例。它假设允许我将数据发送到 Azure。

我查了这个错误,但我没有使用交互式窗口,#r 似乎不是答案。我相信这个问题会阻止我使用我的标题,但我会尝试。

https://catalog.azureiotsuite.com/details?title=Raspberry_Pi3&source=home-page

“对类型 'stream' 的引用声称在 'System.RunTime' 中定义,但找不到。”

引用 Message 的行得到这个,下面带有 await 的行得到它的“任务”

using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.Devices.Client;
using Windows.UI.Xaml.Controls;

namespace MyFirstIotCoreApp
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {

        public MainPage()
        {
            this.InitializeComponent();
            SendDataToAzure();

        }

        private async Task SendDataToAzure()
        {
            DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(<replace>, TransportType.Http1);

            var text = "Hello, Windows 10!";
            var msg = new Message(Encoding.UTF8.GetBytes(text));

            await deviceClient.SendEventAsync(msg);
        }
    }
}

【问题讨论】:

    标签: c# azure windows-10-iot-core azure-iot-hub


    【解决方案1】:

    早安;

     Anytime I see an error referencing a missing item in a Framework library like
    

    那,我首先想到的是检查框架版本。一些功能 仅存在于框架的某些版本中,因为它们开发了新功能。

    查看Framework版本,看看是否选择了支持的版本 那个功能。

    【讨论】:

    • 我最终更改了目标最小版本以匹配目标版本。就我而言,我使用的是 Windows Fall Creators Update (10.0; Build 16299)
    猜你喜欢
    • 2018-10-21
    • 2021-09-08
    • 1970-01-01
    • 1970-01-01
    • 2018-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多