هذا الشرح يفيدك
Website Host Header Value IP Address Port
Test1 -- 10.0.1.1 80
Test2 -- All Unassigned 80
Test3 -- 10.0.1.3 80
Test4 -- 10.0.1.4 80
Will these Websites start: Yes. All of the Websites will be up and running. Remember you can have only one website which can have "All Unassigned" and port XX (when there are no host headers in picture and you have all the sites running on same port XX). No two website can have exactly the same combination of Host header, IP Address and Port.
Here remember you can access the site Test1 only with the IP address 10.0.1.1. If you try to use http://localhost (or http://127.0.0.1) , it will go to some other site (discussed soon). Now using http://servername is a bit tricky. Request will actually go to the site to which your servername resolves from the user's machine. If you do a ping servername and if the IP that it resolves to is set for a specific site like Test3, Test3 will serve the page. If http://servername doesn't resolve to any of the IP addresses on which some sites are specifically configured to listen to, the request will be served by a site which is listening on "All Unassigned" (I know it may be confusing but I am giving an example before coming to theory). If none of the Websites are listening on the resolved IP or "All unassigned" then you will see a "Bad Request (Invalid Hostname)" in the browser (You may check the httperr log to confirm the same).
Let's take for our example that ping servername resolves to 10.0.1.2
So seeing the Websites configuration of Scenario 3 above, which site will should serve the page for the following URLs:
http://servername (remember servername resolves to 10.0.1.2) ? Ans: Test2
http://10.0.1.2 ? Ans: Test2
http://10.0.1.3 ? Ans: Test3
http://10.0.1.4 ? Ans: Test4
http://10.0.1.1 ? Ans: Test1
http://localhost ? (Remember it refers to 127.0.0.1) Ans: Test2
I assume you are getting the logic.
So here comes the explanation:
IIS by default listens on all the IP addresses on the server on a specific port (By default 80).
If you run the command netstat -ano from the command prompt you will see an entry like 0.0.0.0:80. This means that IIS process listens on all IP addresses associated with the server on port 80. Now when you associate a website with a specific IP address and port combination it will listen only on that IP address on that port. It won't accept any request on any other IP address or port associated with the server. When you use "All Unassigned" for a website it means that this website listens on all the IP addresses associated with the server on the specified port. Hence as you may assume from above scenario any web request that is sent to the server on a specific IP address will be served by the website following the above rule...let me clear it again with the above example:
http://servername (remember servername resolves to 10.0.1.2) ?
Ans: Test2 , Reason: When the request reaches IIS server, http.sys driver redirects the request to website Test2 because all other Websites are listening on specific IP's which do not match 10.0.1.2.
Ans: Test2, Reason: It will be sent to and served by Test2 because this is the website which is set to "All unassigned" which means Website is listening on all IP addresses associated with the server. Also this request won't be served by any other site because they are listening on IP's which are different from 10.0.1.2.
Ans: Test3 , Reason: As expected from explanations so far this will be served by Test3 because Test3 is configured to listen to any request directed on IP 10.0.1.3.
Ans: Test4 , Reason: Again the same reason as above, Test4 is configured to listen on IP 10.0.1.4.
Ans: Test1 , Reason: Same logic as above.
http://localhost ? (Remember it refers to 127.0.0.1)
Ans: Test2, Reason: Served by Website Test2, because the request is sent on IP 127.0.0.1 and none of the other Websites are listening on 127.0.0.1. Test2 has "All unassigned" which means it is listening on all IPs on the server including 127.0.0.1 and hence can serve the request. If for testing you change the IP configuration for a website to 127.0.0.1 then all new requests like http://localhost will be served by this specific website.
So the above scenario shows how every request will be served by some site provided we have the configuration like "All unassigned" or specific IP for the sites.