1

I want to deploy a server (on Azure) using SignalR. And the console client, so that it accepts commands from the server.

The server code was taken from here: https://docs.microsoft.com/ru-ru/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr

Example of a console client from here:https://www.codeproject.com/Articles/804770/Implementing-SignalR-in-Desktop-Applications

using Microsoft.AspNet.SignalR.Client;
using System;

namespace SignalRClient
{
    class Program
    {
        static void Main(string[] args)
        {
            IHubProxy _hub;
            string url = @"https://signalrchatmsdn20210410135946.azurewebsites.net/";
            //string url = @"http://localhost:62545";
            var connection = new HubConnection(url);
            _hub = connection.CreateHubProxy("BetHub");
            connection.Start().Wait();

            _hub.On("ReceiveLength", x => Console.WriteLine(x));

            string line = null;
            while ((line = System.Console.ReadLine()) != null)
            {
                _hub.Invoke("DetermineLength", line).Wait();
            }

            Console.Read();
        }
    }
}

If I run the server locally, everything works (string url = @"http://localhost:62545";) If I run the server on Azure, it works through the browser. But the console client throws an exception. System.Net.WebException

What settings should I add to the server?

0 Answers0