How to create an online signalR server

I created a chat application using Signalr and Windows Forms, however, my application is self-service and works only at my localhost address, how can I load a server on the Internet on azure and connect a desktop client application to it? I just started learning Signalr. I did some research on Google, but could not find anything that could answer my question.

+4
source share
2 answers

You only need to publish your signalR hub as a website, it doesn’t matter if you host your website in

  • Azure Web Apps
  • Azure Virtual Machine
  • Azure Cloud Service

"" SignalR - - ASP.Net, , . , .

- ( signalR)

using System;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace SignalRChat
{
    public class ChatHub : Hub
    {
        public void Send(string name, string message)
        {
            // Call the broadcastMessage method to update clients.
            Clients.All.broadcastMessage(name, message);
        }
    }
}

, , - ASP.NET, . , SignalR nuget.

( OWIN) app.MapSignalR, :

using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(SignalRChat.Startup))]
namespace SignalRChat
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // Any connection or hub wire up and configuration should go here
            app.MapSignalR();
        }
    }
}

.

- , , - Azure.

/ , :

: SignalR 2

+2

, - Azure Worker Role .

, , OWIN Azure Worker.

, .

!

: , .

- ASP.NET, IIS, - Azure WebApps. - Azure.

OWIN, , OWIN. .

SignalR.

, , SignalR, .

!

+1

Source: https://habr.com/ru/post/1619282/


All Articles