Base solution for your next web application
Open Closed

SignalR Server @ Azure #5133


User avatar
0
pankajmathur created

Hi,

My below client code (Console Application) successfully connects to the SignalR while server application runs locally.

             var hubConnection = new HubConnectionBuilder()
            .WithUrl("http://localhost:62114/signalr")
            .Build();

            hubConnection.On<string>("getMessage", message => Console.WriteLine(message));
            hubConnection.StartAsync().Wait();

            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();

But if I deploy my server application at azure then my following client (Console application) with the following code, throws "System.Net.WebSockets.WebSocketException. Unable to connect to the remote server" at the line "hubConnection.StartAsync().Wait();"

            var hubConnection = new HubConnectionBuilder()
            .WithUrl("http://ivend365retail-signalrtest.azurewebsites.net/signalr")
            .Build();

            hubConnection.On<string>("getMessage", message => Console.WriteLine(message));
            hubConnection.StartAsync().Wait();

            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();

Please advise how to fix this issue...

Regards, Mahendra


2 Answer(s)
  • User Avatar
    0
    pankajmathur created

    I got the answer.... For the benefit of other people...if you are facing the same issue then please follow this URL....

    <a class="postlink" href="https://docs.microsoft.com/en-us/aspnet/core/signalr/publish-to-azure-web-app?view=aspnetcore-2.1">https://docs.microsoft.com/en-us/aspnet ... etcore-2.1</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @pankajmathur :)