Utilizzo di .Net Reflector su System.Runtime.Remoting.Channels.CoreChannel Ho decompilato i due metodi seguenti. GetMachineIp() viene chiamato quando si configura un HttpChannel per i servizi remoti.System.Runtime.Remoting.Channels.CoreChannel.GetMachineIP() da .NET Reflector: spiegare
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;
}
mia domanda è perché sarebbe Dns.GetHostEntry() in GetMachineIP() esito negativo con SocketException "No Host sconosciuto". GetMachineName() restituisce correttamente (che fa anche un GetHostEntry). Questo sta accadendo solo su una macchina isolata. Potrebbe essere qualcosa a che fare con la registrazione DNS errata?