Deploying Self Hosted SignalR
Asked Answered
E

1

7

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?

Etienne answered 14/11, 2012 at 14:21 Comment(4)
depending on your hosting you might not be able to go through 8088 due to their infrastructure config, I would try something more mainstream such as 80 or 8080 if the server is responsible for other roles too. Otherwise get in contact with the admins and hear if they allow traffic on unknown ports.Serendipity
I'm running from a virtual instance of Windows Server 2008 which I have full admin control over. As far as I'm aware there shouldn't be anything blocking the ports other than Windows Firewall, but I will try using port 8080 and see what happens (the server is also being used as a web server on port 80, so I'll stay away from that).Etienne
It now appears to be connecting, that is to say, connection.Start()... executes without throwing an exception, but then when it tries myHub.Invoke I get "Start must be called before data can be sent."Etienne
This morning in Visual Studio I ran my client project (pointing to my local server project) without running the server project, and I got the same error "Start must be called before data can be sent.", however when I corrected it and ran the server project it worked fine, so I guess my "Start must be called before data can be sent." error is actually just that my client can't connect to my server.Etienne
O
1

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/";
Otolaryngology answered 22/3, 2013 at 23:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.