无法从 Raspberry Pi Mono 项目中的 SignalR 程序集加载 HubConnection [英] HubConnection could not be loaded from SignalR Assembly in Raspberry Pi Mono Project

查看:16
本文介绍了无法从 Raspberry Pi Mono 项目中的 SignalR 程序集加载 HubConnection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Raspberry Pi 中构建一个项目,该项目通过 Signalr 与我的 Azure 服务器进行通信.在处理 Xamarin 项目时,我在单声道项目的 .NET 客户端中使用了 SignalR,并且成功了.出于测试目的,我编写了一小段代码.

I am trying to build a project in Raspberry Pi which communicates with my Azure server via Signalr. I have used SignalR in .NET client side in a mono project while working on a Xamarin project and was successful. For the test purpose, I have written a small block of code.

using System;
using Microsoft.AspNet.SignalR.Client;

namespace testSignalr1
{
  class Program
  {
    static void Main()
     {
        var hubConnection = new HubConnection("******");
        var serverHub = hubConnection.CreateHubProxy("HubTest");
        serverHub.On("broadcastMessage", message => System.Console.WriteLine(message));
        hubConnection.Start().Wait();
        serverHub.Invoke("TestMethod").Wait();
        System.Console.Read();
    }
  }
}

我正在使用 mcs mono 编译器编译它.

I am compiling this using mcs mono compiler.

sudo mcs test.cs /r: /usr/lib/mono/4.5/Microsoft.AspNet.SignalR.Client.dll

程序实际上编译成功.但是当它运行时,我得到以下异常

The program actually compiles successfully. But when it is run, I get the following exception

Could not load type 'Microsoft.AspNet.SignalR.Client.HubConnection' from assembly 'Microsoft.AspNet.SignalR.Client'

我使用的 Microsoft.AspNet.SignalR.Client.dll 是这个 Git 中 lib 文件夹中的那个在 RaspBerry Pi 中演示 SingalR 的项目

The Microsoft.AspNet.SignalR.Client.dll I am using is the one in lib folder in this Git Project which demonstrates SingalR in RaspBerry Pi

这似乎是 SignalR 的单声道编译版本.我无法弄清楚我哪里出错了.提前致谢

This seems to be the mono compiled version of SignalR. I cannot figure out where I am going wrong. Thank You in Advance

推荐答案

ssh 进入 raspberry pi 并输入 sudo apt-get install mono-complete 这对我有用.仅安装 mono-runtime 时,我遇到了同样的问题.

ssh into the raspberry pi and type sudo apt-get install mono-complete this worked for me. I had the same issue when only installed the mono-runtime.

这篇关于无法从 Raspberry Pi Mono 项目中的 SignalR 程序集加载 HubConnection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆