ASP.NET Web Sites on IIS                                                                

Depending on the version of Windows you are working on, your version on IIS may appear quite differently.
For example, Windows 2000 Server was released with IIS 5.0. Windows XP Professional/Media Center
Edition came with the limited IIS 5.1. Windows 2003 Server was released with IIS 6.0, which added support
for application pools.

Windows Vista and Windows Server 2008 were released with IIS 7.0, which has a drastically changed UI. If
you are considering working with Windows Server 2008 or Vista, be sure to set aside time to learn IIS 7.0.
The new layout offers easier access to different configuration settings, but can be initially frustrating to users
experienced with earlier versions of IIS. Important: If you are using Vista, be sure to install Vista SP1 or
higher to ensure that IIS has all of the same options as Windows Server 2008.

Developers can create ASP.NET Web Sites that use IIS to host their Web pages. When you create a new ASP.
NET Web Site with VS 2008, you specify HTTP and an URL to an IIS server. It automatically creates a new
virtual directory. Using virtual directories, a single IIS installation can host multiple Web sites on the same
port (port 80, by default). A virtual directory is simply an alias to a physical folder on the hard drive that
contains all the files for a given ASP.NET application. For example:
http://localhost/WebSiteIIS is really C:
\inetpub\wwwroot\WebSiteIIS\











VS 2008 will put all Web files in this physical directory, except for the Solution (*.sln) and the Solution User
Options (*.suo) files. You can double click on the *.sln file to open your ASP.NET application within VS
2008 (or make use of the
File | Open | Web Site… menu option). These are placed inside the Documents
folder, within the Visual Studio 2008\Projects subdirectory.





































You can see that the virtual directory has already been created for you in IIS. Here is a screenshot of the
newly created virtual directory in IIS 7.0.


















You can also create virtual directories manually from IIS Manager. First assume that you have already created
a physical folder on your hard drive to hold your Web application (e.g. C:\MyWebApp). In IIS Manager,
right-click on the "
Default Web Site", and select "New | Virtual Directory". The picture below shows
Windows XP with IIS 5.1.




























Here is IIS 7.0 in Windows Vista and Windows Server 2008:























In either version, this shortcut launches a wizard that allows you to configure the initial properties of your
Web application (all changeable after creation).
     •        
Step #1:  You will be asked to specify the name of the virtual directory (MyWebApplication).
     •        
Step #2: You will be asked to locate the physical directory used to hold the files (C:
               \MyWebApp).
     •        
Step #3: You will be asked to specify access permissions for the virtual directory (the defaults are
               correct for an ASP.NET application).

At this point, you can populate your application with the files that constitute your Web Site. You don’t need
to manually create a virtual directory unless you wish to create an ASP.NET application in a directory other
than the default root directory (C:\inetpub\wwwroot). Once you have a virtual directory (created with VS
2008 or manually) you can browse the physical folder by right clicking on Web page and selecting "
Browse".

To remove a Web application, simply right-click on the virtual directory (in the IIS management tool) and
select “Delete”. Beware! Deleting a virtual directory in IIS deletes all of the files in the underlying file system!

IIS 7 includes two primary views for working with Web sites:
     •        
Feature View and Content View.
     •        Note the two tabs at the bottom of the screen.






















It is worth pointing out that in IIS on Windows XP/2003, each Web Site or virtual directory can specify
which version of ASP.NET to use. Simply right-click it and select
Properties. From here, click on the ASP.
NET
tab.























•        In IIS 7.0, you configure the ASP.NET version at the Application Pool level.
ASP.NET Web Sites on IIS
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Services