Signal R NET Core

0

I have an error in the start of an application (Console Application) .NET Core 3.1.

First I have a WebAPI .NET Core 3.1 that implements a "Hub" class "ChatWeb" passing the / chatWeb route as an endPoint.

In my console application (.Net Core 3.1 and NuGet - Microsoft.AspNetCore.SignalR.Client 5.0.0) I have the following code:

        public static void Main(string[] args)
    {
        var connection = new HubConnectionBuilder().WithUrl("https://localhost:55587/chatWeb").WithAutomaticReconnect().Build();
        connection.StartAsync().Wait();
        connection.InvokeCoreAsync("EnviarMensagem", args: new[] { "Teste", "mensagem teste" });
        connection.On("RecebendoMensagem", (string nome, string msg) => 
        { 
            Console.WriteLine(nome + ":" + msg);
        });

        Console.ReadKey();
    }

When the application starts it breaks on the HubConnectionBuilder line with the following error:

System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'

FileLoadException: Could not load file or assembly 'System.Text.Encodings.Web, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)

Does anyone have an idea? Thanks in advance!!

c#
.net
.net-core
signalr
asp.net-core-3.1
asked on Stack Overflow Jan 6, 2021 by Rodrigo Costa • edited Jan 6, 2021 by Rodrigo Costa

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0