Pages

Monday, February 8, 2010

Step by Step Guide on How to configure II7

Views

This article will provide you a step by step user guide to provide answers to following question.

  • How to configure IIS7?
  • How to create virtual directory on IIS7?
  • How to do ASP.Net development on IIS7?

First lets start with very basic information about IIS and Web application development on Windows Vista and Longhorn.

  • Version of Internet Information Services (IIS) on the new platform is IIS7
  • Version of ASP.Net/.Net framework installed on Windows Vista is .Net2.0. The OS does not support instalaltion of .Net 1.1 without SP1. So if you want to install .Net 1.1 on the machine, download it from MSDN. The installation will warn you about incompatibility issues with the version of .Net framework. What that is telling you is that you need to install SP1 for .Net framework after installing the framrwork. Otherwise it is not going to work.
  • Installation of Visual Studio 2005 is supported on Windows Vista.
  • Installation of SQL Server 2005 is not supported with out SP1. So if you plan to use SQL Server 2005, then you will have to SP1 after that installation.

1. Installation Of IIS

In my previous article Windows Vista - Add Remove Program I explained how you can enable IIS on your machine. And in another article Server Error HTTP Error 404.3 - Not Found gave some more information about IIS7 configuration issues.

2. Create Virtual Directory

Start IIS Manager console. The user interface will look something like the following image. Right click on Default Web Site node and click on Create Virtual Directory menu item.

IIS Configuration Step 1 IIS Configuration Step 1

3. Specify Name And Path

After you select Create Virtual Directory menu option, you will be presented with a dialog box as shown in the following images. You can specify the Alias and physical path to the directory where virtual directory should be created. Once you have specified these values, you have created your web application virtual directory on IIS7.

IIS7 Configuration 2

You will see the VD node in left view of IIS Manager. Click on it and your center view will look something like the following image.

IIS7 Configuration 3

Now we have a new virtual directory created by following steps described in Page 1. In this page we are going to see how we can modify the settings of our virtual directory. Before we dig deep into this topic let me point out that the user interface for configuring IIS7 is quite different from previous versions IIS6 or lower. In older version you were used to right clicking on virtual directory node in IIS and then pick Properties menu option to configure various settings for your virtual directory or web application. In IIS7 if you right click on virtual directory node, you will not find Properties menu options. Your context menu may look like the following image.

IIS7 configuration 4

Now the properties menu option has been moved in right view pane in IIS Manager console. When you click on your virtual directory, you will see options in right view like the following image.

IIS Configuration 5

4. Change Physical Path

Click on Properties link in right view. It will bring up the dialog box where you can specify the new physical path for your virtual directory. Enter new path and click Ok. There are couple of other options you can set but we will discuss then later. For now we will focus on some essential basics or advanced settings.

IIS7 Configuration

5. Authentication

Next important feature you probably want to configure is authentication for your web application. In the center view, you will find a feature with name Authentication. Double click on it and you will have current settings of the virtual directory come up. Your settings may look like following image.

IIS7 Configuration 7

You will notice that in my case the only authentication enabled is Anonymous. Lets say that you want to enable Forms authentication for your application. Here are the steps that you will need to follow.

  • Disable Anonymous authentication scheme by selecting it in center view and then clicking on Disable link in right view.
  • Now select Forms Authentication in center view and click on Enable link in right view. If you do not disable Anonymous scheme before enabling Forms Authentication scheme, you will get error message saying You cannot use both challenge-based and login redirect-based authentication simultaneously. Which perfectly makes sense because you can only use one type of authentication type in web.config file of your web application. Now your center view may look like the following image.
IIS7 Configuration 8
  • Now we need to configure rest of the elements of Forms Authentication. Select Forms Authentication in center view and then click on Edit link in right view. It will bring up the following dialog box and you can configure all the elements of forms authentication. You will notice that this dialog box has all the elments that you are used to configuring Forms Authentication in your web.config file.
IIS7 Configuration

Following the same procedure you can enable other forms of authentication schemes.


So far we have accomplished the following tasks with IIS7.

  • Created a new virtual directory
  • Configure its physical path
  • Specify authentication scheme to use

If you are not looking into doing any more configuration changes, then you are see set to host the application in this virtual directory as well as do some ASP.Net development for this web application. Next I will show you how to do some more configuration changes.

6. Configure Default Page For Site

Most of web sites have their home page set to one of the following pages.

  • Default.htm
  • Default.asp
  • index.htm
  • index.html
  • default.aspx

This may not be the case all the time. Sometimes you need to set the default page for your home page or folder in your application to something different. In that case you need to set the default document for the web application differently. Click on your virtual directly in IIS Manager and then you will see Default Document feature in center view. Double click on that and you will be presented with the following dialog box where you can specify the default page for your application.

IIS7 Configuration 10

7. Custom Error Pages

Next important task in hand for your web application configuration is setting the custom error pages. These are the pages that you want your users to see when some error occurs. It is always a good practice to redirect the users to some predetermined error page when something goes wrong on the site. It serves multiple purposes.

  • You can keep track of errors and the cause which will help you diagose problems in your application
  • Give user friendly message to the user and redirect them to some other part of the application or site so that they can continue with their visit to your site.

To configure custom error pages, double click on Custom Error Pages feature in center view and it will bring up the following detailed view where you can configure the pages for HTTP errors.

IIS7 Configuration

8. Session State Configuration

Session state configuration is one of the most important tasks in web applicaiton development. You will see Session State feature in center view. Double click on it and it will bring up the following detailed view where you can configure the session state for your application.

IIS7 Configuration

9. More Settings

There are plenty of more settings in IIS7 that you can set to fine tune your web application. In this article series I have covered some basics ones that you need to get started. In the next articles I will discussing more advanced and detailed configuration settings for ASP.Net development as wll as hosting.

0 comments:

Post a Comment

 

Web Design Company karimnagar, Web Designing warangal, Logo Design Company nizamabad, Indian Website Design Company, maddysoft.co.in