Monday, 7 November 2011

IIS installation

IIS is the web server on the windows platform, similar to UNIX’s Apache server. Windows XP Professional SP3 has built in support for Internet Information Services or IIS. The built in version of IIS is 5.1.  When you install windows XP, IIS is not automatically installed and enabled. You need to go to Control Panel to “Add Remove Programs” to setup IIS 5.1. In this post, I am going to show you how to install IIS 5.1 on Windows XP Professional step by step.

Step 1: Open up Control Panel

You will see many icons and one of them is  ”Add or Remove Programs”
Add-Remove-Programs-Control-Panel-Windows-XP
Click on ”Add or Remove Programs”
You will see the following “Add or Remove Programs” window

Add-Remove-Programs-Windows-XP

Step 2: Click on the “Add/Remove Windows Components” on the left

You will see the following window where IIS is listed as one of the options. Its in unchecked condition by default.
Windows-Conponents-Wizard
Click on Details button. You will see the following Window showing Internet Information Services (IIS)
Internet-Information-Services-IIS-Add-Remove-Components
Click on Details button again. You will see the following Window showing World Wide Web Service. Click OK and Viola! your IIS 5.1  server is setup and running on your windows XP professional box.
Word-Wide-Web-Service-Add-Remove-Components

Step 3:  Create a Virtual Directory in IIS 5.1

Click on the start button on the bottom left corner of windows desktop and  choose “Run”. Type “inetmgr” and hit OK.
RUN INETMGR to see IIS Services
When you run inetmgr, you will see the IIS Services window as shown below. It will list all the web sites running on XP. Right click on the “Default Website”  and choose New Virtual Directory menu.
Create-Vistual-Directory-IIS6-Menu
The Virtual Directory Creation Wizard will start up and show the following window.
Virtual-Directory-Creation-Wizard
Click Next and it will ask you to name the Alias for the Virtual Directory. Remember, whatever you type here is your alias and you will need to use this in your URL to access the website virtual directory once its created.
Virtual-Directory-Creation-Wizard-Alias
Next it will ask for you to choose the Physical directory to map to the above alias (virtual directory).
Virtual-Directory-Creation-Wizard-Content-Directory
Once you choose the physical path, click next and it will show you Access Permissions window as shown below. By default Read and Write Scripts (such as ASP) are checked. Since we want to run a CGI program, will go ahead and check Execute (Such as ISAPI applications or CGI”.
Virtual-Directory-Creation-Wizard-Access-Permissions

Step 4:  Setup port and “Execute Permissions” for the Virtual Directory

Now I’ll right click on the Default Web Site node in the IIS manager and choose “Properties”. Go to “Web Site” Tab. By default the port 80 is assigned to the “Default Website”. We have created a Virtual directory “temp” under the default web site. All virtual directories use the same port as the parent web site. I am going to change the port to 81.
Default-Website-Properties-IIS6
Now I’ll right click on the Virtual Directory “temp” in the IIS manager and choose “Properties”. In the following window, choose “Home Directory” tab. In this tab, you will go to Execute Permissions and choose “Scripts and Executables” so that we will be able to run CGI and ASP scripts. The default was “Scripts Only” which is enough to run ASP.NET program scripts.
Default-Website-Properties-IIS6-Home-Directory

Step 5: Browse the ConsoleApplication1.exe to see the output in browser

Open the windows explorer and copy the ConsoleApplication1.exe  CGI Program that we created in C# and Visual C# 2010 Express into the c:\temp folder.   Refer to earlier in my post 8 easy steps to develop and setup C# CGI program in IIS 7 to see how we actually created that exe program in C#.
Now go back to IIS manager and right click on the temp virtual directory and you will see the contents. You will see the ConsoleApplication1.exe on the right hand side. Right click on this exe and choose browse.
Browse-CGI-Application
IIS will launch your default browser (Google Chrome in my case) and call the URL localhost:81/temp/ConsoleAppliaction1.exe. I can modify the URL a bit and append x=1&y=2 and hit enter. You will see the output of the CGI and notice that the GET parameters are properly sent to the CGI program.
CGI-Program-Output-IIS6

No comments:

Post a Comment