简体   繁体   中英

Instead of IP Address use Hostname in IIS 7

I have a simple project in asp.net mvc3 I publish in my local PC and using my IP Address to open it. I try to use the hostname that I set in the IIS but it will not open the project. How to use hostname in IIS7?. Anyone knows?.

To add a hostname in IIS7 follow this procedure from Microsoft:

  1. Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
  2. In the Connections pane, expand the Sites node in the tree, and then select the site for which you want to configure a host header.
  3. In the Actions pane, click Bindings.
  4. In the Site Bindings dialog box, select the binding for which you want to add a host header and then click Edit or click Add to add a new binding with a host header.
  5. In the Host name box, type a host header for the site, such as www.contoso.com.
  6. Click OK.
  7. To add an additional host header, create a new binding with the same IP address and port, and the new host header. Repeat for each host header that you want to use this IP address and port.

This configuration means requests received by IIS for this hostname will be sent to the specific site you have configured.

However you need a configuration for requests to actually arrive to this IIS Server and this is where DNS is used.

Your server can be found via its IP(s) address(es). Here you want your server to be found via a hostname, so you need a configuration somewhere which says your hostname points to your server IP.

  • If this is for an intranet site, ask your network team.
  • If this is for an internet/extranet website, you need to buy a domain name, and your provider will allow you to make the DNS configuration.
  • If this is for local (windows) use only, you can bypass DNS by using the hosts file. Check this page for example. The hosts file allows you to tell your local computer to point a hostname to the IP of your choice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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