简体   繁体   English

IIS 8不接受IP地址作为主机名

[英]iis 8 not accepting ip address as hostname

We are trying to specify IP address instead of hostname(eg: www.abc.com) for WCF service hosted in IIS v8.0 on windows server 2012 我们正在尝试为Windows Server 2012上的IIS v8.0中托管的WCF服务指定IP地址而不是主机名(例如:www.abc.com)

在此处输入图片说明

This gives error saying special characters not allowed. 这会产生错误,提示不允许使用特殊字符。 Is this not allowed? 这是不允许的吗? But it works fine when we specify IP address as host name in our local systems which runs IIS v7.5. 但是,当我们在运行IIS v7.5的本地系统中将IP地址指定为主机名时,它可以正常工作。

在此处输入图片说明

A hostname is not an IP address, therefore you can't specify it in the site bindings as a host name. 主机名不是 IP地址,因此您不能在站点绑定中将其指定为主机名。

If you are trying to access a service on your local IIS machine, simply having the site binding present is enough, but you may want to bind it to a specific IP address (the IP address dropdown), or if you leave it as "All Unassigned" then the application will be available on all IPs registered with the server, on your chosen port. 如果您尝试访问本地IIS计算机上的服务,只需提供站点绑定就足够了,但是您可能希望将其绑定到特定的IP地址(IP地址下拉列表),或者将其保留为“全部”。未分配”,那么该应用程序将在您选择的端口上在服务器注册的所有IP上可用。

If you are trying to access an app on another machine from yours, you can either get a DNS value added by your network admin, or change your HOSTS file (C:\\windows\\system32\\drivers\\etc\\HOSTS) and add in your own alias: 如果您尝试从自己的计算机访问另一台计算机上的应用程序,则可以获取网络管理员添加的DNS值,也可以更改HOSTS文件(C:\\ windows \\ system32 \\ drivers \\ etc \\ HOSTS)并添加到自己的别名:

54.XXX.XXX.XXX myalias

Which means you should then be able to access http://myalias:8092/ from your browser. 这意味着您应该能够从浏览器访问http://myalias:8092/

Update The validation message is apparently by design: 更新验证消息显然是设计使然的:

http://blogs.msdn.com/b/dasane/archive/2013/10/16/adding-ip-address-like-host-head-in-iis-8-shows-ui-validation-error-this-worked-fine-in-iis-7-5-and-earlier.aspx http://blogs.msdn.com/b/dasane/archive/2013/10/16/adding-ip-address-like-host-head-in-iis-8-shows-ui-validation-error-this-工作细,在-IIS-7-5-和earlier.aspx

Reading that article, I can now understand why you may want to use an IP address as a host-header, as it effectively allows you to route external IP address calls to your local machine without requirement of DNS changes. 通过阅读该文章,我现在可以理解为什么您可能想将IP地址用作主机头,因为它有效地使您可以将外部IP地址调用路由到本地计算机,而无需更改DNS。 For what you need though, if the IP address is bound to an NIC on your local machine, just leave it blank as it will resolve locally anyway. 但是,对于您所需的内容,如果IP地址绑定到本地计算机上的NIC,则将其保留为空白,因为无论如何它将在本地解析。

Check what you provided in Hosts file (C:\\Windows\\system32\\drivers\\etc folder) in your local machine 检查您在本地计算机上的主机文件(C:\\ Windows \\ system32 \\ drivers \\ etc文件夹)中提供的内容

For the above case you need to provide the hostname not ip address 对于上述情况,您需要提供主机名而不是IP地址

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM