I can't connect to my Signalr resource using HubConnectionBuilder with the endpoint

Solucion Distribucion 0 Reputation points
2024-07-27T16:19:35.87+00:00

Good day, I have created my Signalr resource, I have my hostname and my endpoint, then I make a connection from a WPF test application with the following code:

HubConnection _connection = new HubConnectionBuilder().WithUrl("https://signalresource***.service.signalr.net").Build();

_connection.On<string, string>("ReceiveMessage", (user, message) =>{Dispatcher.Invoke(() =>{string aa = message;});});

await _connection.StartAsync(); //connection's error

but I get a connection error, I do not use tokens, the connectivity to the hostname provided by the Azure portal does indicate successful but the endpoint returns an error. Please can someone help me solve or do I need to configure something in signalr, I have only created the resource and tested the connection. Thanks you!

Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
147 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 18,451 Reputation points
    2024-07-30T00:56:01.4166667+00:00

    Hi @Solucion Distribucion we're sorry to hear you're facing this issue. It looks like this is a potential configuration issue with your SignalR connection. Here are some troubleshooting steps to examine and resolve the problem:

    • SignalR targets ES6. For browsers that don't support ES6, transpile the library to ES5. For more information, see Getting Started with ES6 – Transpiling ES6 to ES5 with Traceur and Babel. So make sure that both the SignalR client and server are using compatible versions. Mismatched versions can sometimes cause connection issues.
    • Check the logs and error messages for more details. Sometimes, the error messages can provide specific information about what might be going wrong.
    • Ensure you've created a SignalR Hub in your backend application that matches the hub name you're referencing in the code ("ReceiveMessage").
    • Make sure that there are no firewall or network issues blocking the connection. This includes checking any proxies or firewalls that might be in place.

    Best,

    Grace

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.