Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying Self Hosted SignalR

I have created a pair of C# based console apps based on this SignalR Console app example.

This works brilliantly on my local PC, and I have now copied the server app (plus all files from the bin/Release folder) onto my server. When I run the server app, it happily sits there listening on "http://www.redacted.com:8088/".

In the client app, I changed:

var _connection = new HubConnection("http://127.0.0.1:8088/");

to:

var _connection = new HubConnection("http://www.redacted.com:8088/");

However I now get a 503 Server Unavailable error when I try to start the connection. I'm a newbie to SignalR, and haven't managed to find a decent tutorial with regards to deployment (largely because there are probably so many different ways it can be done depending on requirements I guess).

So my questions are:

  1. Do I need to set anything up in IIS for this to work (bearing in mind I'm not looking at this being web based, just console app to console app), or is it okay to just run the server exe and open the port up?

  2. My server is running Windows Server 2012, and I have added my exe to the list of applications that are allowed to make connections, and have added an incoming rule for port 8088, is there anything else I need to do in order to be visible to my client?

like image 348
Mottster Avatar asked Nov 14 '12 14:11

Mottster


People also ask

Does SignalR need server?

Supported server operating systems Note that for SignalR to use WebSockets, Windows Server 2012, Windows Server 2016, or Windows 8 is required (WebSocket can be used on Windows Azure Web Sites, as long as the site's .

Where can I host a SignalR?

A SignalR server is usually hosted in an ASP.NET application in IIS, but it can also be self-hosted (such as in a console application or Windows service) using the self-host library. This library, like all of SignalR 2, is built on OWIN (Open Web Interface for . NET).

Does SignalR require WebSockets?

ASP.NET Core SignalR is a library that simplifies adding real-time web functionality to apps. It uses WebSockets whenever possible. For most applications, we recommend SignalR rather than raw WebSockets.


1 Answers

If you have something along these lines on the server

      string url = "http://127.0.0.1:8088/";
      var server = new Server(url);
      server.MapHubs();
      server.Start();

Try binding to all IPs (or hosts)

      string url = "http://*:8088/";
like image 128
Jani Hyytiäinen Avatar answered Sep 23 '22 17:09

Jani Hyytiäinen