问题描述
我试图建立树莓派一个项目,该项目通过Signalr我的Azure服务器进行通信。我曾经在一个单项目中使用SignalR在.NET客户端上Xamarin项目时和成功。
对于测试的目的,我已经写了一小段代码块
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单编译器。
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我现在用的就是这个
这似乎是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进入树莓pi和输入sudo apt-get的安装单完成这个工作对我来说。我有同样的问题时,只安装了单运行。
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.
这篇关于HubConnection无法在树莓派Mono项目从SignalR大会装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!