Saturday, June 7, 2008

How To: Create a Website using IIS 6 - Level 100

After checking initial stats related to search queries that reached this blog I have decided to write an introductory article on How to create a website using IIS 6.

For the beginners, you must know that IIS 6 is not part of the default installation on Windows Server 2003 as compared to it's predecessor. Therefore to get started with your website you will first need to install IIS 6 on a windows server 2003 (IIS is available on all the versions). That can be achieved in 2 ways ...

  • Server Manager
  • Add\Remove Programs (Windows Components-Application Server-IIS)
If you intend to run ASP.Net pages then you will have to choose that explicitly as well.
Note: Post-installation you will need to enable ASP through Web Server Extensions, if you plan to run them.
Ok, once the installation is done, the next thing that we would be needing is the actual content that is to be hosted. For the sake of this article I will be using.
  1. A very simple HTML page.(sample.htm -Save file in C:\Inetpub\wwwroot)
  2. A very simple ASP page.(sample.asp -Save file in C:\Inetpub\wwwroot)
In IIS 6 the page available by default is iisstart.htm, however, this page has the tendency to confuse people as the page says Under Construction ... :)

In the past I have had numerous cases wherein the users complained of IIS installation going bad. When asked, they told me that this was the page they were viewing when they typed in localhost for the 1st time. ;)

Whereas, in IIS 7 this page is great and shows you a good image of IIS 7 with a few links. I like it in IIS 7 if you ask me.

Anyways, To create a website,

Click on Start -> Administrative Tools ->Internet Information Services (IIS) Manager

This will open up a window.To view the pages that we just saved, go to Default Web Site. On the right hand-side pane you will notice that you would already have 2 files(sample.htm and sample.asp) listed. To view them right-click on the file and click browse. Perhaps, while browsing the sample.asp page you may receive an error Service Unavailable.

This will come up if you have not yet allowed Active Server Pages extension from the Web Service Extensions. To do it,
Go to Web Service Extensions ->Select Active Server Pages ->Select Allow
Now refresh the sample.asp page in the browser and this time you will be able to browse it. But, all this was working with the already created website, What if we wanted to create a new website all together? Well lets do that now,

  1. Right-click on Web Sites -> Select New-> Website.This will open up a Website creation wizard. Click next and give a description, say sample -> next.
  2. Enter the Ip address for your website. If you have any reason to work on a specific port then you could specify that as well. Next.
  3. Browse to the content location. In my particular case, I will creating a website whose content in based in the E: drive
    Note: If you want everyone to browse this website then you can keep the checkbox that says (Allow Anonymous access to this Website )
  4. Let the default check boxes be as they are and click next. Click Finished.
And that's it, your website in now created and will be up and running. However, this website will be running under the Default Application Pool. As an advice, it is always appropriate to have different websites running under different App Pools, this gives us lot more flexibility.
If you need to understand this concept better, read my blog on Difference Between Virtual Directories and App Pools. Therefore to achieve that create an Application Pool by the name sample:
Application Pool -> New -> Application Pool and give it a name sample where it says App Pool ID.
To associate this Application Pool to our Sample website.
Right-Click on the Sample website-> Properties -> Home Directory Tab -> Under Application Settings . Click on the Application Pool drop down and select the Sample. Hit Apply. OK.
And now we are done. You will now be able to
  • Create a sample website with the content and settings of your choice.
  • Create an Application Pool and associate it to your website.
FYI, If you create a website with the same Ip Address and Port as that of any other pre-existing website, your website will be created but will be in a stopped state. It will not function until you stop the other website and explicitly start the new one.

As always, let me know if any issues.

1 comments:

Anonymous said...

i have a question for you... I am a newbe.If you already have a 2003 server with IIS6 running a website and you have to add additional wesites. How do you configure IIS to provied the new website without impacting the existing one.