简体   繁体   中英

SignalR error with Mono on Raspberry Pi

I am trying to execute some C# code on a Raspberry Pi, specifically some SignalR code.

But the thing is that it compiles just fine, creates the executable, but when I run it I get this error.

HubConnection could not be loaded from SignalR Assembly in Raspberry Pi Mono Project

Basically, I have the same problem, except that the answer from there (sudo apt-get install mono-complete) doesn't work for me, because I already have it up to date.

I get this error :

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

This is the source code which works fine on Windows and Xamarin(MacOS):

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {

            var hubConnection = new HubConnection("http://mspmaplocator.azurewebsites.net");
            var hub = hubConnection.CreateHubProxy("MapHub");

            hub.On<string, string>("onMarkerPlace", (latitude,longitude) => Console.WriteLine("Latitude: {0} \nLongitude: {1}\n", latitude, longitude));

            hubConnection.Start().Wait();

            Console.ReadLine();
        }
    }
}

When I compile this code with macs, I do it like this in the terminal.

mcs Program.cs -r:Microsoft.AspNet.SignalR.Client.dll

Even if it works in Xamarin Studio, it still doesn't work in the Mac OS terminal or Linux terminal(tried Ubuntu and Raspberry).

Do I need to compile it differently or against other libraries?

Thanks!

Make sure that the SignalR library and System, System.Web are compatible with one another. This may happen if either you don't run using these libraries, or if they are different versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM