3
votes

I have a server running .net 4.5.1 with SignalR (IIS)

I want to connect to the server using a console client app on .net core 2,2. I have installed the below Nuget package on the client

Microsoft.AspNetCore.SignalR.Client;

and have followed

https://docs.microsoft.com/en-us/aspnet/core/signalr/dotnet-client?view=aspnetcore-2.2

I keep getting the below error

"There was an error opening the connection:System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found)."

The name of my Hub on the server is correct so I'm not sure of the problem

I have also tried

.WithUrl("http://172.10.0.20:81/client/?hub=myHub")

please help

connection = new HubConnectionBuilder()

//.WithUrl("http://172.10.0.20:81/client/?hub=myHub")

.WithUrl("http://172.10.0.20:81/myHub")

.Build();

connection.StartAsync().ContinueWith(task => {

if (task.IsFaulted)

{Console.WriteLine("There was an error opening the connection:{0}",

task.Exception.GetBaseException());}

else

{Console.WriteLine("Connected");}}).Wait();

connection.StartAsync();
2

2 Answers

2
votes

I can't reproduce your problem . But since your server is hosted on .net 4.5.1 , please make sure that you are using same version of SignalR both on server side and client side .

That means that you you cannot use the ASP.NET CORE SignalR (Hub or Client) with the ASP.NET SignalR (Hub or Client). You can't mix them. You can click here for more info .

0
votes

thanks that pushed me in the right direction.
I'm using signalR with webforms so the hub is located at

http://172.10.0.20:82/signalr/myHub

After changing path I got the below informative error

There was an error opening the connection:System.IO.InvalidDataException: Invalid negotiation response received. ---> System.InvalidOperationException: Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server.