简体   繁体   English

IIS - 无法通过 IP 地址而不是本地主机访问页面

[英]IIS - can't access page by ip address instead of localhost


I'm trying to publish ClickOnce application and test it locally.我正在尝试发布ClickOnce应用程序并在本地进行测试。 I want to provide installation link so I need to update location with an IP address otherwise I won't be able to install it (because localhost is translated into computer name and it's not accessible).我想提供安装链接,所以我需要使用 IP 地址更新位置,否则我将无法安装它(因为localhost被转换为计算机名称并且无法访问)。 The problem is, that on my IIS I can access my page only by using localhost in the address.问题是,在我的IIS我只能通过在地址中使用localhost来访问我的页面。

http://localhost:9995/publish/Publish.htm <-- working 
http://192.168.1.104:9995/publish/Publish.htm <-- not working (my IP address)
http://my_pc_name:9995/publish/Publish.htm <-- not working
http://127.0.0.1:9995/publish/Publish.htm <-- even that is not working

I'm using Windows 7 and Visual Studio 2012 with IIS Express 8.0 , but I tried the same on Visual Studio 2010 and it's ASP.NET server and still failed.我将Windows 7Visual Studio 2012IIS Express 8.0 ,但我在Visual Studio 2010上尝试了相同的方法,它是ASP.NET server ,但仍然失败。 I have my firewall turned off.我关闭了防火墙。

Do you have any ideas what can be wrong?你有什么想法可能是错的吗?

So I had this same problem with WSUS and it turned out that IIS 8.5 was not binding to my ipv4 ip address, but was binding to ipv6 address.所以我在 WSUS 上遇到了同样的问题,结果是 IIS 8.5 没有绑定到我的 ipv4 ip 地址,而是绑定到了 ipv6 地址。 when I accessed it via localhost:8580 it would translate it to the ipv6 localhost address, and thus would work.当我通过 localhost:8580 访问它时,它会将其转换为 ipv6 localhost 地址,因此可以工作。 Accessing it via ip was a no go.通过 ip 访问它是不行的。 I had to manually bind the address using netsh, then it worked right away.我必须使用 netsh 手动绑定地址,然后它立即起作用。 bloody annoying.该死的烦人。

Steps:脚步:

  1. Open command prompt as administrator以管理员身份打开命令提示符
  2. Type the following:键入以下内容:

netsh http add iplisten ipaddress (IPADDRESSOFYOURSERVER)

that's it.而已。 You should get:你应该得到:

IP address successfully added

I found the commands here https://serverfault.com/questions/123796/get-iis-7-5-to-listen-on-ipv6我在这里找到了命令https://serverfault.com/questions/123796/get-iis-7-5-to-listen-on-ipv6

The IIS is a multi web site server. IIS 是一个多网站服务器。 The way is distinct the site is by the host header name.方式是不同的站点是由主机头名称。 So you need to setup that on your web site.所以你需要在你的网站上设置它。

Here is the steps that you need to follow:以下是您需要遵循的步骤:

How to configure multiple IIS websites to access using host headers? 如何配置多个 IIS 网站以使用主机头访问?

In general, open your web site properties, locate the Ip Address and near its there is the advanced, "multiple identities for this web site".通常,打开您的网站属性,找到 IP 地址,在其附近有高级的“此网站的多重身份”。 There you need ether to add all income to this site with a star: "*", ether place the names you like to work with.在那里,您需要以太币将所有收入添加到带有星号的站点:“*”,以太币放置您喜欢使用的名称。

Maybe it helps someone too:)也许它也可以帮助某人:)

I'm not allowed to post images, so here goes extra link to my blog.我不允许张贴图片,所以这里有额外的链接到我的博客。 Sorry.对不起。

IIS webpage by using IP address 使用IP地址的IIS网页

In IIS Management : Choose Site , then Bindings .在 IIS 管理中:选择站点,然后选择绑定

Add添加

  • Type : http类型:http
  • HostName : Empty主机名:空
  • Port : 80端口 : 80
  • IP Address : Choose from drop-down menu the IP you need (usually there is only one IP) IP 地址:从下拉菜单中选择您需要的 IP(通常只有一个 IP)

Check the settings of the browser proxy .检查浏览器代理的设置。 For me it helped , traffic was directed outside.对我来说它有帮助,交通被引导到外面。

In my case it was because I was using a port other than the default port 80. I was able to access the site locally using localhost but not on another machine using the IP address.就我而言,这是因为我使用的是默认端口 80 以外的端口。我能够使用 localhost 在本地访问该站点,但不能使用 IP 地址在另一台机器上访问。

To solve the issue I had to add a firewall inbound rule to allow the port.为了解决这个问题,我必须添加一个防火墙入站规则来允许端口。 在此处输入图片说明

尝试禁用 Windows 防火墙,它对我有用,但就我而言,我能够通过 127.0.0.1 访问 IIS

I was trying to access my web pages on specific port number and tried much things, but I've found the port was filtered by firewall.我试图通过特定端口号访问我的网页并尝试了很多东西,但我发现该端口被防火墙过滤了。 Just added a bypass rule and everything was done.刚刚添加了一个绕过规则,一切都完成了。

Maybe help someone!也许可以帮助某人!

In IIS Manager, I added a binding to the site specifying the IP address.在 IIS 管理器中,我添加了一个绑定到指定 IP 地址的站点。 Previously, all my bindings were host names.以前,我所有的绑定都是主机名。

Follow the below steps -请按照以下步骤操作 -

  1. In IIS Right click the "Default Web Site"在 IIS 中右键单击“默认网站”
  2. Click Edit Buildings in the context menu单击上下文菜单中的编辑建筑物
  3. Select and edit选择和编辑
  4. Give your machine IP instead of "*" in IP Address在 IP 地址中提供您的机器 IP 而不是“*”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IIS7-使用IP地址和端口号将不会显示网站主页,但使用localhost将显示 - IIS7 - Using an ip address and port number will not display a web site home page but using localhost will IIS-端口8080上的网站可以使用localhost访问,但不能使用外部IP地址访问 - IIS - Website at port 8080 can be accessed using localhost but not with external IP address 安装Oracle和回送适配器后无法访问localhost / iis - Can't access localhost/iis after installing Oracle and loopback adaptor 网页不同显示localhost和IP地址 - web page different display with localhost and ip address IIS 6强制IIS显示dotnetnuke的主机名而不是IP地址 - IIS 6 force IIS to display hostname instead of ip address for dotnetnuke 无法从本地IP访问IIS网站 - Can't access IIS website from local IP 如何通过 IP 地址范围限制页面访问? - How can I restrict page access by IP address range? 如何通过我的IP地址从远程计算机访问本地托管的IIS网站? - How Can I Access Locally Hosted IIS WebSite from Remote Computer By My IP Address? 使用IP地址而不是localhost时获取HTTP错误400 - Getting HTTP Error 400 when using IP address instead of localhost 无法使用 ip:port 访问 WEB API,但在 VS 调试模式下可以使用 localhost:port - Can't access WEB API with ip:port but can with localhost:port during VS debug mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM