为什么我在ASP.Net越来越:: 1的IP地址..和如何得到正确的IP地址? [英] Why am I getting ::1 as IP address in ASP.Net.. and how to get the proper IP address?

查看:106
本文介绍了为什么我在ASP.Net越来越:: 1的IP地址..和如何得到正确的IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行在本地主机ASp.Net MVC应用程序 - 与Visual Studio给开发服务器。我想获得的IP地址。我试过

I am running a ASp.Net mvc app in localhost - dev server given with visual studio. I want to get the IP address. I tried

Request.UserHostAddress

Request.ServerVariables(REMOTE_ADDR)

在这两种情况下,我正在:: 1作为结果。它是什么?为什么会出现呢?我怎样才能得到127.0.0.1或192.168.1.xxx?

In both cases, I am getting ::1 as the result. What is it? Why am I getting it? How can I get 127.0.0.1 or 192.168.1.xxx?

推荐答案

您得到一个有效的IP地址。 :: 1 在IPv6中local_host。 (下划线的local_host用于从以为这是某种不好的文字,以便停止)

You are getting a valid IP Address. ::1 is local_host in IPv6. (underscore used in local_host to stop SO from thinking it was some sort of bad text)

这篇关于为什么我在ASP.Net越来越:: 1的IP地址..和如何得到正确的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆