Hosting Multiple websites/applications on IIS – Part 1

IIS is the lonely web server –rather than web development server - in the Microsoft stack and the most recent one IIS7 add more flexibility, control and ease of use to IIS. There is a bunch of concepts need to be clear in mind when it comes to host information and pages on IIS to allow sharing then over the Internet, an intranet or an extranet. To host data you on IIS you will use websites, application and virtual directories. Those concepts was hanging around from previous versions.

Sites, virtual directories, and applications

Those three concepts is the building blocks you will use to host you websites, web applications, web pages and any other resources. In this post we will discuss the concept of website.

 

So what is Website?

A website (or web site) is a collection of related web pages, images, videos or other digital assets that are addressed with a common domain name or IP address in an Internet Protocol-based network. A web site is hosted on at least one web server, accessible via the Internet or a private local area network. – wiki-

In IIS a A site is the top-level logical container that specifies how HTTP requests are received and processed - it defines a group of bindings that determine how the site listens for incoming requests, and contains the definitions of applications/virtual directories that partition the site's URL namespace for the purposes of structuring your application content. :) Thanks mike

Ok this is what website means … oops! then it must map to physical folder, physical files, and resources ...etc? yes that’s right.

IIS Default website Web servers works on a client server technology. In the simplest case this means that the client – usually web browser- requests a certain resources webpage, images ..etc from the web server e.g. IIS  using an http request. The web server picks up the request and maps it the appropriate website. In IIS there is a default website called Default Website which maps to C:\inetpub\wwwroot folder –inetpub is the default installation folder of IIS- We can add as many as websites we need but the main issue we need to address is that those websites should to be uniquely identified within the IIS server. Otherwise the web server -IIS- will no be able to redirect the incoming http requests to the correct website.

Site Binding

To uniquely identify website you will use site binding to configure Http.sys to listen on IP addresses and ports. Site binding includes two main attributes which is the binding protocol and the binding information. Okay so lets have a look to the DeafultWebsite site binding. Choose the default website> Edit Binding from DefaultSite context menu. As we can see: the binding protocol is http this means that the communication between the client and the server will occur over the http protocol. And we can see the binding information which consists of: IP address, Port and host header.

Multipl host headers on website3

What this means? this means that when a client requests your web server lets say that we have an intranet server called alpha by typing http://alpha in his browser the web server will pick up the request and maps its to the DefaultWebsite over the http protocol using any available IP address on port 80 which is the default port for http protocol.

Ok,what if we need to have multiple website rather than the DefaultWebsite?

As we stated above IIS is designed to host multiple websites by default each of them must be uniquely identified so to carry out we need to play with binding information parts:

  • IP address
  • TCP Port
  • Host Header

The decision to which way you need to follow is determined in respect of your needs and available resources. Ok lets create additional three website to be host on our machine each to clarify this issue.

Using IP address

In IIS you can configure websites to listen to incoming http requests on all available IP address -unassigned- or on individual IP address. And by this you need to configure your website with certain IP address. Ok IIS> Sites> Add Web site and we need to fill the Site Name, Path, and in the binding information are type your certain website. Keep the other option as the same.

This will add addional site in the IIS. The site configuration appears like this in the applicationHost.config file

<site name="SiteBindingUsingIP" id="3">
               
<application path="/" applicationPool="SiteBindingUsingIP">
                   
<virtualDirectory path="/" physicalPath="C:\SiteBindingUsingIP" />
                </
application>
               
<bindings>
                   
<binding protocol="http" bindingInformation="172.20.2.193:80:" />
                </
bindings>
</site>

IPSite

One disadvantage of this approach is that IP address is not always free to use. So assigning an IP address to every website may be a non eligible choice.

Using Custom TCP Port

We can change allow website to learn to a non-default TCP port rather than port 80 which is the default port of http protocol. What you need to do to accomplish this is the same of the previous step but you need to provide a unique and avail be TCP port. In the attached image the new site WebSite2 is using the same IP address of WebSite1 but on different port which 8080. 

When users request the site they need to provide the TCP port after the name of the server or the IP address like this: http://sitename:PortNumber/ or http://IpAddress:PortNumber/. E.g. http://websit2:8080 or http://172.20.2.192:8080

TCPPortSite

The main disadvantage of this method is that the users need to know on which port the website is working and append the TCP port to the website address and this not eligible on all case.

Using Host Headers

HTTP Host: headers are a feature of the HTTP v1.1 specification that allows a web server to host multiple web sites on a single IP address and TCP port, while simultaneously allowing HTTP v1.1 clients to specify the web site they wish to connect to. The process requires that the client send a Host: HTTP header as part of the HTTP request specifying a web site it wishes to access, and the web server having a web site configured with a corresponding HTTP Host: header value.

Follow the same previous steps to define the website and fill the host header you need at the Host name field. You can change the TCP port but this will make no sense since host headers is enough to distinguish between websites on the same IP address.

HostHeader

One website can have multiple hosting headers you can add more host headers by adding more bindings with different host names. To edit the site bindings Choose the desired site > Edit Binding and you can add/edit/and remove bindings. Multipl host headers on website3

Clients could not be able to connect to the web server using host headers unless you those host headers are defined in the appropriate DNS Server or Host File. IIS is not a name resolution server its a web server so the mechanism how the users can contact your web server with the names you choose –host headers- is not the responsibility of the IIS server.

Host Headers and SSL

To use host headers with https a certain configuration should took a place. Until Windows 2003 SP1 IIS6 could not handle host headers over SSL. This is because that the host headers themselves are encrypted within the entire encrypted http request so when the http request is being received on the IIS it could not figure out to which website it should be redirected. After the SP1 IIS6 or by using IIS7 you can use wildcard certificates to handle host headers over https –we will  not go throw this process in this post-

 

Hope this helps. In the next post we will have a look to Application Pool concept.

Original post at PalDev

86 Comments

  • nice article, Thanks!
    Rado

  • Thanks. This helped alot. Im trying to learn the popular web servers. I got Apache, NGINX (Engine-X), HFS and some other one that I forgot

  • Really it was most helpfull.

  • I loved The Host and I don't care that much for horror. I thuoght it was very funny and creative and would recommend it to anyone who doesn't mind subtitles. The odd ball family is what makes the film, not the monster.

  • Great write-up, I am normal visitor of one’s
    blog, maintain up the excellent operate, and
    It's going to be a regular visitor for a long time.

  • Hi there just wanted to give you a quick heads up.
    The words in your post seem to be running off
    the screen in Safari. I'm not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I'd post to let you know.

    The style and design look great though! Hope you get the issue solved soon.
    Thanks

  • I constantly emailed this weblog post page to all my
    associates, as if like to read it next my links will too.

  • We are a group of volunteers and opening a new
    scheme in our community. Your web site provided us with valuable info to work on.
    You have done an impressive job and our entire community
    will be thankful to you.

  • Very soon this web page will be famous amid all blog viewers, due to
    it's good articles or reviews

  • Hi there colleagues, its great post about tutoringand fully defined,
    keep it up all the time.

  • What's Happening i am new to this, I stumbled upon this I've found It
    absolutely helpful and it has helped me out loads.

    I'm hoping to contribute & help different users like its helped me. Great job.

  • You can certainly see your skills in the work you write.

    The world hopes for more passionate writers such as you who are not afraid to mention how they
    believe. All the time follow your heart.

  • Everything is very open with a clear description of the challenges.
    It was really informative. Your site is very useful. Thanks for
    sharing!

  • Great goods from you, man. I've understand your stuff previous to and you are just extremely fantastic. I really like what you've acquired here,
    really like what you are stating and the way in which you say it.
    You make it enjoyable and you still care for to keep it sensible.
    I can not wait to read far more from you. This is actually a
    tremendous web site.

  • Undeniably consider that which you said. Your favourite reason appeared to be on
    the internet the easiest factor to keep in mind of.
    I say to you, I definitely get irked whilst people consider issues that they plainly
    don't recognize about. You managed to hit the nail upon the top and defined out the entire thing without having side effect , people could take a signal. Will likely be back to get more. Thanks

  • Can you tell us more about this? I'd love to find out more details.

  • Hey! Do you use Twitter? I'd like to follow you if that would be okay. I'm definitely enjoying your blog
    and look forward to new updates.

  • Pretty element of content. I simply stumbled
    upon your website and in accession capital to assert that I get in fact loved
    account your weblog posts. Anyway I'll be subscribing on your augment and even I achievement you get right of entry to consistently rapidly.

  • You've made some really good points there. I checked on the net to learn more about the issue and found most individuals will go along with your views on this site.

  • I read this post fully concerning the resemblance of hottest and previous
    technologies, it's remarkable article.

  • I'm really enjoying the design and layout of your blog. It's a very
    easy on the eyes which makes it much more
    enjoyable for me to come here and visit more often.

    Did you hire out a developer to create your theme? Outstanding work!

  • whoah this weblog is magnificent i really like reading your articles.
    Stay up the good work! You already know, many individuals are hunting round for this info, you could help them greatly.

  • Excellent weblog right here! Additionally your website lots up very fast!
    What host are you using? Can I get your associate link on your
    host? I wish my web site loaded up as fast as yours lol

  • I was recommended this blog by my cousin. I am not sure whether this post is written
    by him as no one else know such detailed about my difficulty.

    You're wonderful! Thanks!

  • We are a group of volunteers and opening a new scheme in our community.
    Your website provided us with valuable information to work on.
    You have done a formidable job and our entire community will be thankful to you.

  • My family members all the time say that I am killing my time here at net, however I know I am getting knowledge daily by reading such pleasant articles.

  • I seldom drop comments, but after reading through a few of the comments on this page Hosting Multiple websites/applications on IIS – Part 1 - Huthaifa Afanah.
    I actually do have 2 questions for you if you do not mind.

    Could it be only me or do some of these remarks
    look as if they are left by brain dead visitors? :-P And, if you
    are posting on additional sites, I'd like to keep up with you. Would you list of the complete urls of all your social networking sites like your twitter feed, Facebook page or linkedin profile?

  • It's impressive that you are getting ideas from this article as well as from our discussion made at this place.

  • If some one needs expert view on the topic of running
    a blog then i propose him/her to pay a quick visit this website,
    Keep up the nice work.

  • Hello are using Wordpress for your site platform? I'm new to the blog world but I'm trying to get started and create my own.
    Do you require any html coding knowledge to make
    your own blog? Any help would be really appreciated!

  • Do you have a spam issue on this site; I also am a blogger, and I was wondering your situation; many of us have developed
    some nice procedures and we are looking to swap strategies with others, please
    shoot me an email if interested.

  • Hey there! This is my first visit to your blog!
    We are a group of volunteers and starting a new initiative in a community in
    the same niche. Your blog provided us valuable information to work on.
    You have done a extraordinary job!

  • This article is truly a fastidious one it assists new net
    visitors, who are wishing for blogging.

  • Hey there! Someone in my Facebook group shared this
    site with us so I came to take a look. I'm definitely enjoying the information. I'm book-marking and will
    be tweeting this to my followers! Exceptional
    blog and outstanding design and style.

  • Heya i am for the first time here. I found this board and I find
    It really useful & it helped me out much. I hope to give something back and aid others like you helped me.

  • I constantly spent my half an hour to read this blog's articles or reviews every day along with a mug of coffee.

  • Hey there! I could have sworn I've been to this website before but after browsing through some of the post I realized it's new to me.
    Anyhow, I'm definitely delighted I found it and I'll be book-marking
    and checking back frequently!

  • Heya i am for the first time here. I came across this board and
    I find It really useful & it helped me out much. I hope to give something back and help others like you aided me.

  • You ought to be a part of a contest for one of the most useful sites on the internet.
    I am going to recommend this blog!

  • Why people still make use of to read news papers when in this technological world
    all is accessible on net?

  • I am curious to find out what blog system you have been using?
    I'm experiencing some small security issues with my latest website and I would like to find something more secure. Do you have any solutions?

  • Hey this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors
    or if you have to manually code with HTML. I'm starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

  • always i used to read smaller content that as well clear their motive, and that is also happening with this piece of writing which I am reading here.

  • I'm impressed, I must say. Seldom do I encounter a blog that's both equally educative
    and entertaining, and without a doubt, you have hit the nail on the head.
    The problem is something which not enough folks are speaking intelligently
    about. Now i'm very happy that I stumbled across this during my search for something relating to this.

  • Greetings! Very useful advice within this article! It is
    the little changes that produce the greatest changes.
    Thanks for sharing!

  • Hi, i think that i saw you visited my blog so i got here to return the desire?
    .I am trying to in finding issues to improve my web site!
    I assume its good enough to use a few of your ideas!
    !

  • Very nice post. I just stumbled upon your blog and wanted to say
    that I've really enjoyed browsing your blog posts. After all I'll be subscribing to your feed and I hope you write again soon!

  • Hi there! This blog post could not be written any better! Reading through this post reminds me of my previous roommate!
    He continually kept preaching about this.
    I most certainly will send this post to him. Pretty sure
    he'll have a very good read. Thanks for sharing!

  • Can I just say what a comfort to uncover a person that actually understands
    what they are talking about on the internet. You certainly know how to bring an issue to light and make
    it important. A lot more people have to read this and understand this side of the story.
    I was surprised you are not more popular since you most certainly have the gift.

  • I like it when people come together and share thoughts.
    Great blog, stick with it!

  • Hey! I just wanted to ask if you ever have any problems with hackers?

    My last blog (wordpress) was hacked and I ended up losing many months of hard
    work due to no data backup. Do you have any methods to prevent hackers?

  • Good article. I am dealing with a few of these issues as well.
    .

  • Very good post! We will be linking to this great content on our
    website. Keep up the great writing.

  • Its like you read my mind! You seem to know so much about this, like you wrote
    the book in it or something. I think that you can do with
    a few pics to drive the message home a bit, but instead of that, this is magnificent blog.

    An excellent read. I'll certainly be back.

  • I all the time used to study paragraph in news papers but now as I am
    a user of internet therefore from now I am using net for articles, thanks to web.

  • An impressive share! I've just forwarded this onto a co-worker who has been conducting a little research on this. And he in fact ordered me breakfast because I found it for him... lol. So let me reword this.... Thanks for the meal!! But yeah, thanx for spending the time to talk about this topic here on your site.

  • Hi there! I realize this is kind of off-topic but I needed
    to ask. Does managing a well-established website such as yours require a large amount of work?

    I am completely new to operating a blog however I do write in my
    journal daily. I'd like to start a blog so I can easily share my own experience and views online. Please let me know if you have any kind of ideas or tips for brand new aspiring bloggers. Thankyou!

  • Excellent, what a blog it is! This weblog presents helpful information to us, keep it up.

  • These are truly enormous ideas in about blogging.
    You have touched some nice factors here. Any way keep up
    wrinting.

  • Hello to every body, it's my first go to see of this website; this website contains amazing and in fact good material designed for visitors.

  • Way cool! Some extremely valid points! I appreciate you writing this
    article and the rest of the website is really good.

  • You really make it seem so easy with your presentation but I
    find this matter to be really something which I think I would never understand.
    It seems too complicated and very broad for me.
    I'm looking forward for your next post, I'll try to get the
    hang of it!

  • Very quickly this web site will be famous among all blogging people, due to it's fastidious articles or reviews

  • What's up to all, how is the whole thing, I think every one is getting more from this site, and your views are nice in support of new users.

  • I have been surfing online more than three hours lately, yet I by no means found any attention-grabbing article like yours.
    It's pretty worth sufficient for me. Personally, if all webmasters and bloggers made good content material as you probably did, the web will probably be much more useful than ever before.

  • Good information. Lucky me I ran across your
    blog by chance (stumbleupon). I have book-marked it for later!

  • You could definitely see your skills within the
    work you write. The world hopes for more passionate writers such as you who are not afraid
    to say how they believe. All the time follow your
    heart.

  • Incredible! This blog looks just like my old one! It's on a entirely different topic but it has pretty much the same layout and design. Wonderful choice of colors!

  • Hello colleagues, its great article about teachingand completely explained, keep it
    up all the time.

  • I know this if off topic but I'm looking into starting my own blog and was curious what all is needed to get set up? I'm assuming having a blog like yours would cost a pretty penny?
    I'm not very web savvy so I'm not 100% certain. Any tips or advice would be greatly appreciated. Thank you

  • I have been surfing online more than 2 hours today, yet I never found any interesting article like
    yours. It is pretty worth enough for me. In my opinion, if all website owners and bloggers made
    good content as you did, the web will be a lot more useful than
    ever before.

  • information is not enough. i didn't able to use it. My problem is not solved.

  • Hey I know this is off topic but I was wondering if you knew of any widgets
    I could add to my blog that automatically tweet my newest twitter updates.

    I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  • Hurrah, that's what I was seeking for, what a information! present here at this weblog, thanks admin of this site.

  • Quality content is the crucial to invite the people to go to see the
    web page, that's what this web site is providing.

  • of course like your web site but you need to check the spelling on several of your posts.
    Many of them are rife with spelling problems and
    I find it very troublesome to inform the reality then again I
    will certainly come again again.

  • SL4qeM Looking forward to reading more. Great article.Thanks Again. Will read on...

  • Hello to every body, it's my first go to see of this website; this webpage contains awesome and really excellent information in support of readers.

  • That is very attention-grabbing, You are a very professional blogger.
    I've joined your rss feed and look forward to looking for more of your magnificent post. Additionally, I have shared your site in my social networks

  • Pretty nice post. I simply stumbled upon your blog and wanted to say that I have really enjoyed surfing around your blog posts.
    After all I will be subscribing for your feed and I hope you write again soon!

  • Good write-up. I definitely love this site. Keep writing!

  • Pretty component of content. I simply stumbled upon your site and in accession capital to
    assert that I acquire in fact loved account your
    weblog posts. Any way I will be subscribing on your feeds or even I achievement you access consistently rapidly.

  • always i used to read smaller articles or reviews that as
    well clear their motive, and that is also happening with this
    article which I am reading now.

  • I tend not to leave a leave a response, but I browsed a lot of responses
    here Hosting Multiple websites/applications on IIS – Part 1
    - Huthaifa Afanah. I actually do have a couple of questions for you if it's allright. Could it be simply me or do some of these remarks look like they are coming from brain dead people? :-P And, if you are posting on other places, I'd like to follow you.
    Could you list of every one of your social networking pages like your linkedin profile, Facebook page
    or twitter feed?

  • Hi there mates, how is everything, and what you wish for to say about this paragraph, in my view its in fact awesome in
    favor of me.

  • constantly i used to read smaller content which as well clear their motive, and that
    is also happening with this article which I am reading now.

Comments have been disabled for this content.