14

Between IIS 6 and IIS 7.5 (and versions prior to 6 as well, I am sure), there's Default Website under Sites. I've never really questioned what, exactly, Default Website means. It seems that the convention here is to place all your websites under Default Website, so it leaves me questioning what's so "default" about it when you place your other websites beneath it. Is the purpose of default website to hold default configurations that need to be inherited by all websites beneath it or is there something else to it? In other words, when would I ever want to add my new website to the Sites folder as opposed to Default Website.

FYI, I am migrating IIS 6 websites to a new server and will be using IIS 7.5 going forward, so this question applies mainly to IIS 7.5.

enter image description here

2
  • 3
    Just guessing: maybe the site that is shown when no Host header is sent, in an old HTTP 1.0 request? Or the site to choose during a HTTPS handshake, when no host name might be known yet?
    – Arjan
    Oct 13, 2014 at 13:42
  • See also: <VirtualHost> directive. ;)
    – Daniel B
    Oct 13, 2014 at 14:47

3 Answers 3

16
+50

The Default Website is what its name says, a convenience website that is created when IIS is installed. It can be deleted and replaced by new websites, but its advantage is that it will work "out-of-the-box" with all definitions and permissions already taken care of. Getting the folder and file permissions right is perhaps the biggest headache when creating a new website.

Here is a screenshot of the attributes of the default website :

default attributes

The important attributes above are :

Application pool : Each such pool is nothing else than an instance of w3wp.exe, one per pool (IIS will start more than one under a heavy load). It runs here under the user account named DefaultAppPool, which was already given the minimum required permissions on the folders of the website.

Physical Path : This is the folder which will contain all the files of the website (except for files in virtual folders). Default is C:\inetpub\wwwroot.

Bindings : The important one is http:*.80, meaning the HTTP protocol on port 80. The others are used for example for handling WCF services, and depend on your Windows configuration. It's important to note that port 80 cannot be assigned to another site as long as it's assigned to this one. The full syntax for an entry is protocol/IP_address:port:host_header, where unspecified items are taken to mean "all", so that this default means "all IP addresses and domain names and hosts".

How this works

IIS listens on all the specified ports for requests employing a URL of the general format:

protocol://[username:password@]domain[:port]/path/file[?parameters]

The request is then forwarded to the (one) site that handles the specified combination of protocol, domain and port. Unspecified elements have their defaults, or the browser may in some cases ask for missing elements such as username and password.

A path, if specified, is generally appended to the Physical Path in a purely textual manner. For example, the URL http://domain/path/file is translated for the Default website to C:\inetpub\wwwroot\path\file. If the path-name starts with the name of a virtual directory that points to another folder, say D:\myWWWroot, the preceding part of the folder path is replaced, so that the file specification will become D:\myWWWroot\remainder-of-path\file.

Why the Default Website exists

The reason for its existence is simply because there are too many details one has to get right when creating in IIS a website from scratch.

I already touched upon the file and folder permissions, which are the main reason why one may get the infamous "HTTP Error 404.0 - Not Found" message, when one can swear that the specified file exists. This arrives when the user account for the application pool is missing permissions on some folder in the generated physical path.

The Default Website takes over and answers all HTTP requests arriving over port 80 to all IP addresses assigned to the computer where it is installed, translating all HTTP URLs to a physical path to a file inside C:\inetpub\wwwroot.

It's by far much easier to start with the Default Website, modifying its attributes as needed, rather than create everything from scratch, and especially if one has little experience with IIS 7+. The fact that all required user accounts and the permissions on C:\inetpub are predefined may prevent a lot of puzzled head-scratching.

This is also important for security, because by default IIS is pretty invulnerable to hacking. Vulnerabilities are created when the defaults are carelessly modified, or when vulnerable add-on products are added.

1

Default websites:

  • Receive requests on port 80
  • Specific host header is not needed

A request to http://domain.com/test/hello.aspxwith host: domain is received on port 80, and is dispatched to “Default Web Site”.Then, its routed to the root application, and the root virtual directory within it, and the physical path of the file served for this request becomes c:inetpubmysitetesthello.aspx.

Customized Site:

  • “MySite” site also listens on port 80 of all interfaces
  • only receives requests that specify “mysite” in the host header.

A request to http://mysite.com/test/hello.aspx with host:mysite is received on port 80, and is again dispatched to “MySite”.It is routed to the root “/” application, but within that application, it is routed to the “/test” virtual directory, because the http://mysite.com/test part of the url matches the virtual directory’s path.So, the physical path of the file served becomes c:inetpubtesthello.aspx.

Note: Application pool can be common to both the Default Website and customized sites.enter image description here

Hope this helps!

1
  • A very critical thing that Vembu's answer demonstrates is the "default" nature of the "Default Web Site". The default HTTP Port (80) with any host name would handle any incoming requests, out of the box following an IIS install.
    – radiok
    Oct 15, 2014 at 19:32
-1

There was actually quite a bit of change around this specific topic with the release of IIS 7, which was a complete redesign and rewrite of IIS. The Default Web Site is simply the first, and most common, "site" on your IIS server. It is true you can place sites beneath your "Default Web Site" but these are actually nested "applications". Sites are mapped to a specific folder, and generally applications are mapped to specific nested subfolders.

There's a lot to this topic that I can't do justice too. But to answer your immediate question, it's really just a name, "default" doesn't exactly come all the implications that come to mind. As for why you would ever create multiple sites versus creating applications under your default site has more to do with the bindings. The "Default Web Site" uses http port 80 for example, in practice you probably won't frequently open up another http port for serving web pages, so your other websites will probably be nested under the "Default Web Site". Personally, I look at the "Default Web Site" more like the root website.

There's a really useful article regarding this topic on iis.net that you might not have seen Understanding Sites, Applications, and Virtual Directories on IIS 7, although it is, as ever, vague about the "Default Web Site" specifically in question.

2
  • Are you saying that other sites on the same IIS installation would not use port 80? (I don't know IIS, but I'd really doubt that, and Vembu's answer seems to state otherwise.)
    – Arjan
    Oct 15, 2014 at 19:09
  • Nothing I said indicates other sites would not, and as Vembu's answer indicates, you can setup another site with port 80, but any other site would require a host header.
    – radiok
    Oct 15, 2014 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .