7
votes

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?

1
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.cillierscharl
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).Mottster
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."Mottster
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.Mottster

1 Answers

1
votes

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/";