I am trying to learn how to connect to the SignalR Server using the C# client. And I am not sure if the steps I am performing would be considered ok (would work). As I am getting errors of course...
I am trying to establish a connection to the site as:
var connection = new HubConnectionBuilder() .WithUrl(new Uri("http://localhost:5100/appsHub")) .WithAutomaticReconnect() .Build();
Once I run this I get the below. I am not quite sure what is the issue though here is it because of the link? Or should I use a different project by default?
Inner Exception 1: FileLoadException: Could not load file or assembly 'System.Text.Encodings.Web, Version=220.127.116.11, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
And then I want to send the id to the URL As a JSON object.
I have been trying to get this working for a week and yes, I am not sure how to do it :(.
Any help would be appreciated.
Be careful with tutorials. Usually they use latest package versions. E.g. ASP.NET Core SignalR .NET Client offers to do this:
This works fine if the latest package version targets the same framework version as your project does. But if your project targets another framework version, then you will get errors like you posted.
At the moment default target framework for console apps in VS2019 is
Either change target framework to
net5.0 for your console app, or use
Microsoft.AspNetCore.SignalR.Client v3.1.x (3.1.10 is the latest compatible with
This package versioning is very annoying, IMO.
We have about 300 projects, and our LTS version will use
netcoreapp3.1 till the end of its life. If one opens LTS version sources and Nuget tab inside VS now, he sees a lot of "available" package updates. But these updates cannot be applied because of incompatible framework versions. These garbage hides important updates for a number of third-party packages, which targets
netstandard and don't belong to .NET Core/.NET.
As a result, a lot of wasted time to monitor updates for third-party packages.
Your problem is probably the version incompatibility of the project framework and the "* .SignalR.Client" package.
Right click on your project and check the target framework version from the properties menu. Versions must be compatible with the "* .SignalR.Client" package.
User contributions licensed under CC BY-SA 3.0