【问题标题】:Rabbit MQ on RPi WIN10 IoTRPi WIN10 IoT 上的 Rabbit MQ
【发布时间】:2017-03-22 14:55:27
【问题描述】:

我正在尝试在我的 Visual Studio 2017 Raspberry Pi 项目中安装 RabbitMQ。

我正在尝试两种不同的方式:

1) This first : https://paolopatierno.wordpress.com/2015/08/17/windows-iot-core-and-m2mqtt-a-simple-marriage/
    I'm trying to add RabbitMqClient instead of M2Mqtt used in this tutorial.
    I've got this error (in french) :

Install-Package : Le package RabbitMQ.Client 4.1.1 n'est pas compatible avec uap10.0 (UAP,Version=v10.0). Le package RabbitMQ.Client 4.1.1 prend en charge :
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.5 (.NETStandard,Version=v1.5)

But i use .NET 4.5.1 or +. And when I'm trying to add the "RabbitMQ.Client.dll" to my project, I've got the following error :

'A reference to '...' could not be added. The project targets '.NETCore' while the file reference targets '.NETFramework'. This is not a supported scenario.'


2) The second way i'm trying to explore is to create a new "Background Application (IoT)" but i have the same errors.

感谢您的帮助,抱歉英语不好。

【问题讨论】:

    标签: raspberry-pi rabbitmq iot windows-10-iot-core


    【解决方案1】:

    目前,UWP 不支持 RabbitMQ.Client,因为它有一些 UWP 不支持的依赖项。所以,你得到了那些错误信息。

    但 .NET Core 支持 RabbitMQ.Client。

    Windows iot 核心最近提供了 .NET Core(目前还不是正式版本)。

    注意:某些信息与预发布产品有关,在商业发布之前可能会进行重大修改。对于此处提供的信息,Microsoft 不作任何明示或暗示的保证。

    因此,您可以在支持 RabbitMQ.Client 的 Windows iot 核心上运行 .Net Core 应用程序、控制台应用程序等。你可以这样做:

    1. 创建 .Net Core 控制台应用程序。
    2. 使用此命令为应用安装 RabbitMQ.Client:

      dotnet add package RabbitMQ.Client

    3. Add the namespace and code lines.

    4. 将应用程序编译为 ARM 平台的可执行文件。

    5. 将您的应用(在以下路径中)复制到 Raspberry Pi 并执行 .exe。

    [YOUR PROJECT NAME]\bin\Debug\netcoreapp2.0\win8-arm\publish

    更多信息可以参考“Running Native .NET Core Apps on Raspberry Pi (ARM)”。

    【讨论】:

    • Helo Rita Han,非常感谢您的回答。我现在在 Core Console App 项目中有一个带有 RabbitMQ 的 .exe。在这个项目中,我输入了这段代码(worker.cs):rabbitmq.com/tutorials/tutorial-two-dotnet.html 当我从连接到我的 RPi3 的 Powershell 启动它时,.exe 启动,如果有消息但会立即停止,则使用我的队列中的一条消息。你对这个问题有什么想法吗?再次感谢。
    • 你试过用Putty代替Powershell吗?
    • 非常感谢!这样可行 !!!你怎么解释? :) 我有最后一个问题,你知道是否可以将此 .exe 设置为服务?如果 RPi3 崩溃或重新启动,此 .exe 必须自动启动。再次感谢您的回复。
    猜你喜欢
    • 2016-01-28
    • 1970-01-01
    • 2019-03-08
    • 1970-01-01
    • 2021-01-23
    • 2016-11-01
    • 2018-07-30
    • 1970-01-01
    • 2018-08-08
    相关资源
    最近更新 更多