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!!
User contributions licensed under CC BY-SA 3.0