DNS не работает на онлайн сервере
Привет,
Я хочу, чтобы имя клиентского компьютера, на котором АСП.Сетевое веб-приложение запущено.
Я использую приведенный ниже код:
var hostEntry = Dns.GetHostEntry(Request.UserHostAddress); Response.Write("machinename=" + hostEntry.HostName);
Он работает в автономном режиме, но не работает на онлайн-сервере.
Он показывает эту ошибку:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.Sockets.SocketException: No such host is known Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SocketException (0x2af9): No such host is known] System.Net.Dns.GetAddrInfo(String name) +471 System.Net.Dns.InternalGetHostByAddress(IPAddress address, Boolean includeIPv6, Boolean throwOnFailure) +125 System.Net.Dns.GetHostEntry(String hostNameOrAddress) +5390027 Web.TestMachineName.GetMachineName() +282 Web.TestMachineName.Page_Load(Object sender, EventArgs e) +5 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627