Is there a different between using 127.0.0.1 vs localhost?
I ask this because I have noticed a difference when defining wcf connections.
<client>
<endpoint binding="netTcpBinding" bindingConfiguration="netTcpNosecurity" contract="MyClass" name="MyName" behaviorConfiguration="megaGraphBehavior" address="net.tcp://localhost:8011/myname" />
</client>
In some environments i have noticed that a server suddenly starts throwing this error when using localhost and i can only make it work by using 127.0.0.1.
Could not connect to net.tcp://localhost:8011/myname. The connection attempt lasted for a time span of 00:00:02.2341176. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8011. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8011
How can this be explained and should i always use 127.0.0.1?
Localhost by default references the IPv6 address on IPv6 enabled machines. Perhaps the server-side endpoint is only accessible via IPv4?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With