SignalR port requirement

21,990

SignalR has no preference for a specific port. When no port in specified in the URL then the port is implied from the protocol, e.g. HTTP uses port 80 and HTTPS uses port 443. So there is no concept of SignalR without a port.

I would think that the main reason for using SignalR on a different port than the rest of your site is that you can host SignalR independently of your main site without any interference in URL's etc. On the other hand, using a non-standard port may give you problems with restrictive firewalls that only allows traffic on port 80 and 443 to pass. When using a different port for SignalR you also lose the ability to use relative URL's to specify the SignalR endpoint.

Share:
21,990
user1019042
Author by

user1019042

Updated on July 24, 2022

Comments

  • user1019042
    user1019042 almost 2 years

    I haven't found much discussion about this... Most signalr samples I have seen would send and receive via a designated port like 5000 or 8080 I have a need for chatting in my app. My asp.net backend site does more than just handling messages between users, so it doesn't make a difference for me to host another page for that in the site my iis. I understand the difference of having the signalr self-hosted or hosted normally in iis... If I have it hosted by iis, so my users will access the page normally without a port, would that make a difference? Is there something internal in signalr that is preferring the use of a port? What are the pros/cons of using ports with signalr?

  • Tore Aurstad
    Tore Aurstad about 3 years
    From experience, after writing two-way WCF services (old-school) using WsHttpDualBinding - running communications on anything but standard port 443 (or port 80, if you are going down that road) - spells trouble. This is because you must then set up firewall rules to let the communication through. So - are there any differences between port 443 or using a completely different port for corporate firewalls ? Anybody experienced this ?
  • Martin Liversage
    Martin Liversage about 3 years
    @ToreAurstad I'm not sure I understand your question. As I have explained SignalR does not care about the port. It uses a URL and the protocol is implied from the URL. The port is implied from the protocol but you can change it in the URL. Essentially, SignalR is at a layer in the network stack where you specify an HTTP or HTTPS URL. The browser and server handles all the complexities of the communication. If your question is about corporate firewalls I'm afraid I can't answer.
  • Tore Aurstad
    Tore Aurstad about 3 years
    Okay, so you can serve the data over https and http on port 80 and 443. That would be easier to get working with corporate firewalls. The data flows also from server to client, so it could give issues in case there are policies on inbound traffic for these ports to the clients in the corporate intranet.