Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. signalR client server stops working after DNS-ip record for server changed

signalR client server stops working after DNS-ip record for server changed

Scheduled Pinned Locked Moved C#
sysadminquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    impeham
    wrote on last edited by
    #1

    I am using signalR client and service applications - both hosted as console apps. I'm interested in making the following scenario work: 1. One Service starts up at "someaddress.org" 2. Second service starts up at "172.123.2.5" 3. Client starts and creates a hub proxy to an address "someaddress.org" which points to "172.123.2.3" by the DNS server 4. Client starts to receive updates from the server 5. At some point, the server crashes and is not available anymore 6. A Health checker service detects that the service is down, and updates the DNS server to make "someaddress.org" point to "172.123.2.5" where the second (identical) service is already up At this point, the client is not able to establish connection with the new server and I'm trying to understand why and make it work. If the first service is going down and up again all is working fine, but when the DNS record changes to another server it does not work anymore. Any ideas?

    L D 2 Replies Last reply
    0
    • I impeham

      I am using signalR client and service applications - both hosted as console apps. I'm interested in making the following scenario work: 1. One Service starts up at "someaddress.org" 2. Second service starts up at "172.123.2.5" 3. Client starts and creates a hub proxy to an address "someaddress.org" which points to "172.123.2.3" by the DNS server 4. Client starts to receive updates from the server 5. At some point, the server crashes and is not available anymore 6. A Health checker service detects that the service is down, and updates the DNS server to make "someaddress.org" point to "172.123.2.5" where the second (identical) service is already up At this point, the client is not able to establish connection with the new server and I'm trying to understand why and make it work. If the first service is going down and up again all is working fine, but when the DNS record changes to another server it does not work anymore. Any ideas?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Does the client recognise that the server has gone down and do a new DNS lookup? Also updates to DNS servers can take some time to proliferate through the system.

      I 1 Reply Last reply
      0
      • I impeham

        I am using signalR client and service applications - both hosted as console apps. I'm interested in making the following scenario work: 1. One Service starts up at "someaddress.org" 2. Second service starts up at "172.123.2.5" 3. Client starts and creates a hub proxy to an address "someaddress.org" which points to "172.123.2.3" by the DNS server 4. Client starts to receive updates from the server 5. At some point, the server crashes and is not available anymore 6. A Health checker service detects that the service is down, and updates the DNS server to make "someaddress.org" point to "172.123.2.5" where the second (identical) service is already up At this point, the client is not able to establish connection with the new server and I'm trying to understand why and make it work. If the first service is going down and up again all is working fine, but when the DNS record changes to another server it does not work anymore. Any ideas?

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Clients don't do a DNS lookup on every request. They do it one and cache the result. If the server goes down and someone changes the IP the DNS name points to, the clients are going to have to clear their DNS cache and do another lookup of the name to get the new IP. As already has been said, DNS changes take time to propagate, so if the server goes down and the clients detect it, they MAY still get the old IP address for the DNS name they have. Changing the IP address in DNS is NOT the normal way to do failover. If reliability is that important, Google for "IIS Failover Cluster" and start reading. This is far more complicated that just changing an IP address in DNS.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        I 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Clients don't do a DNS lookup on every request. They do it one and cache the result. If the server goes down and someone changes the IP the DNS name points to, the clients are going to have to clear their DNS cache and do another lookup of the name to get the new IP. As already has been said, DNS changes take time to propagate, so if the server goes down and the clients detect it, they MAY still get the old IP address for the DNS name they have. Changing the IP address in DNS is NOT the normal way to do failover. If reliability is that important, Google for "IIS Failover Cluster" and start reading. This is far more complicated that just changing an IP address in DNS.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
          Dave Kreskowiak

          I Offline
          I Offline
          impeham
          wrote on last edited by
          #4

          i wonder if the signalR client works this way. i made a test locally - created an entry in the host file: 127.0.0.1 testaddress both the client and the server are configured to use "testaddress" as host name. when it runs, all is working well, then i change the entry to another ip address: 127.0.0.3 testaddress as expected - all is working well as the connection is still intact. now if i stop the server,wait a few seconds, then change the entry back to: 127.0.0.1 testaddress and restart the server - the connection never re-establishes - client generates errors and finally closes. these are the events raised in this scenario: hubConnection.Error - happens about 10 times hubConnection.Closed if i do the same scenario without changing the host name record (stopping the server, waiting a few seconds and restarting it), it returns to working well even if i wait a longer time - these are the events raised from the client in this case: hubConnection.Error - happens a few times until i start the server again and then hubConnection.Reconnecting hubConnection.Reconnected

          D 1 Reply Last reply
          0
          • L Lost User

            Does the client recognise that the server has gone down and do a new DNS lookup? Also updates to DNS servers can take some time to proliferate through the system.

            I Offline
            I Offline
            impeham
            wrote on last edited by
            #5

            see my previous response for further details as i was testing it by changing the hosts file locally. the client recognizes that the server has gone down - the following event is raised by it: hubConnection.Error

            1 Reply Last reply
            0
            • I impeham

              i wonder if the signalR client works this way. i made a test locally - created an entry in the host file: 127.0.0.1 testaddress both the client and the server are configured to use "testaddress" as host name. when it runs, all is working well, then i change the entry to another ip address: 127.0.0.3 testaddress as expected - all is working well as the connection is still intact. now if i stop the server,wait a few seconds, then change the entry back to: 127.0.0.1 testaddress and restart the server - the connection never re-establishes - client generates errors and finally closes. these are the events raised in this scenario: hubConnection.Error - happens about 10 times hubConnection.Closed if i do the same scenario without changing the host name record (stopping the server, waiting a few seconds and restarting it), it returns to working well even if i wait a longer time - these are the events raised from the client in this case: hubConnection.Error - happens a few times until i start the server again and then hubConnection.Reconnecting hubConnection.Reconnected

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Yeah, that doesn't replicate what happens with an actual DNS entry. It's not the SignalR client that handles the resolution and caching of the IP address from the host name. It's the TCP/IP stack that does it.

              Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
              Dave Kreskowiak

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups