Usando .Net Reflector en System.Runtime.Remoting.Channels.CoreChannel Descompilé los 2 métodos siguientes. Se llama a GetMachineIp() al configurar un HttpChannel para la comunicación remota.System.Runtime.Remoting.Channels.CoreChannel.GetMachineIP() de .NET Reflector - explique
internal static string GetMachineIp()
{
if (s_MachineIp == null)
{
IPHostEntry hostEntry = Dns.GetHostEntry(GetMachineName());
AddressFamily addressFamily = Socket.SupportsIPv4 ?
AddressFamily.InterNetwork : AddressFamily.InterNetworkV6;
IPAddress machineAddress = GetMachineAddress(hostEntry, addressFamily);
if (machineAddress != null)
{
s_MachineIp = machineAddress.ToString();
}
if (s_MachineIp == null)
{
throw new ArgumentNullException("ip");
}
}
return s_MachineIp;
}
internal static string GetMachineName()
{
if (s_MachineName == null)
{
string hostName = GetHostName();
if (hostName != null)
{
IPHostEntry hostEntry = Dns.GetHostEntry(hostName);
if (hostEntry != null)
{
s_MachineName = hostEntry.HostName;
}
}
if (s_MachineName == null)
{
throw new ArgumentNullException("machine");
}
}
return s_MachineName;
}
Mi pregunta es ¿por qué Dns.GetHostEntry() en GetMachineIP() fallará con SocketException "No existe el anfitrión se conoce". GetMachineName() regresa con éxito (que también hace GetHostEntry). Esto solo ocurre en una máquina aislada. ¿Podría ser algo relacionado con el registro DNS incorrecto?