locked
I cant load my website using the hostname RRS feed

  • Question

  • User-1467697349 posted
    My problem is that my asp.net website on my local IIS7 can only work if the host name box is empty.I assign port numbers in the binding so it works but I want to use hostname and port number. I even added the hostname in the host file. Ex. 127.0.0.1 www.mywebsite.com But still the server is not found when I browse the website. Is this a common problem, Help me out please....
    Wednesday, June 20, 2012 4:55 AM

Answers

  • User-1731511703 posted

    The hostname box in the bindings correlates to the URL that the request is coming in on.  It is an integral part of the domain name resolving in DNS to an IP address on your server.

    With that being said, you can 'trick' it since you are just doing local testing.  If you want to use Hostnames as part of your local testing then you need to add them to the hosts file on your local machine.

    In Explorer open up  hosts with notepad from C:\Windows\System32\drivers\etc.  There you would add an entry consisting of your local IP address and the domain name.  For example, if your IP address on your machine was 192.168.1.10 then you would add:

    192.168.1.10  www.yourdomain.com

    What happens is that for DNS resolution it first looks at your local hosts file.  If an entry isn't there it then queries Internet DNS servers. This allows you to 'trick' DNS resolution for local testing and allow you to do testing with hostnames in IIS without actually adding a domain to DNS or changing your live domain name's DNS entry for testing.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, June 26, 2012 7:44 AM
  • User521890537 posted
    I assign port numbers in the binding so it works but I want to use hostname and port number. I even added the hostname in the host file. Ex. 127.0.0.1 www.mywebsite.com But still the server is not found when I browse the website.

     This is not a correct set up. You need to purchase domain name (configured as hostname) and point it to your computer IP.

    You can follow Rick Barber's advice to modify hostfile and trick your computer to resolve www.mywebsite.com to 127.0.0.1

    However you can only access www.mywebsite.com on your computer. It won't work on the internet.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, June 29, 2012 1:29 AM

All replies

  • User-1499466209 posted

    Hi,

    what error did you get? 400 Bad hostname

    could you post here the content of of your website bindings

    Wednesday, June 20, 2012 6:07 AM
  • User2039363532 posted

    Hi!

    I think you havent done binding properly.

    Also check if the site is running proper on local Machine in which you bind port for your site.

    Regards.

    Wednesday, June 20, 2012 11:08 AM
  • User-76669496 posted

    Open a command prompt and ensure the IP is listening on port 80.

    netstat -an

    Confirm your site binding is correct as well. Ensure you do not have any other sites listening on same ip, port, and hostname.

    http://technet.microsoft.com/en-us/library/cc731692(v=ws.10).aspx

    Wednesday, June 20, 2012 12:29 PM
  • User-1467697349 posted
    Website binding is Type: http IPAddress: All unsigned Port:83 Hostname: www.umbracolocal.com This is the error I get. Firefox can't find the server at www.umbracolocal.com. But when I remove the Hostname it works. I use the localhost:83 to load the website,but I want the website to use the hostname.
    Monday, June 25, 2012 5:29 AM
  • User-1731511703 posted

    First of all your bindings aren't correct.  If you want it to respond to localhost:83 and www.umbralocal.com then you need two bindings on the site:

    All unassigned - 83 - <blank hostname>
    All unassigned - 80 - www.umbralocal.com

    That will allow the site to respond to both http://localhost:83 as well as http://www.umbralocal.com assuming that www.umbralocal.com is on a DNS server somewhere that resolves to one of the IP addresses on your IIS server.


    Monday, June 25, 2012 6:47 AM
  • User-1467697349 posted
    Hi,Rick Barber Am testing my web applications on my local machine, IIS is on my local machine. I dont have DNS server.
    Tuesday, June 26, 2012 4:39 AM
  • User-1731511703 posted

    The hostname box in the bindings correlates to the URL that the request is coming in on.  It is an integral part of the domain name resolving in DNS to an IP address on your server.

    With that being said, you can 'trick' it since you are just doing local testing.  If you want to use Hostnames as part of your local testing then you need to add them to the hosts file on your local machine.

    In Explorer open up  hosts with notepad from C:\Windows\System32\drivers\etc.  There you would add an entry consisting of your local IP address and the domain name.  For example, if your IP address on your machine was 192.168.1.10 then you would add:

    192.168.1.10  www.yourdomain.com

    What happens is that for DNS resolution it first looks at your local hosts file.  If an entry isn't there it then queries Internet DNS servers. This allows you to 'trick' DNS resolution for local testing and allow you to do testing with hostnames in IIS without actually adding a domain to DNS or changing your live domain name's DNS entry for testing.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, June 26, 2012 7:44 AM
  • User521890537 posted
    I assign port numbers in the binding so it works but I want to use hostname and port number. I even added the hostname in the host file. Ex. 127.0.0.1 www.mywebsite.com But still the server is not found when I browse the website.

     This is not a correct set up. You need to purchase domain name (configured as hostname) and point it to your computer IP.

    You can follow Rick Barber's advice to modify hostfile and trick your computer to resolve www.mywebsite.com to 127.0.0.1

    However you can only access www.mywebsite.com on your computer. It won't work on the internet.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, June 29, 2012 1:29 AM