How to Test and Debug an ASP.NET 2.0 Application
(Page 1 of 5 )
In this article, you will learn how to create a website that runs under IIS for testing purposes. You will also learn how to create and test a file-system website with the ASP.NET Development Server. It is excerpted from chapter four of the book
Murach's ASP.NET 2.0 Web Programming with VB 2005, written by Joel Murach and Anne Boehm (Murach, 2006; ISBN: 1-890774-32-4).
How to create ASP.NET web sites that run under IIS
In chapter 2, you learned how to create a file-system web site that runs under the ASP.NET Development Server. If you have access to an IIS web server, though, you may want to create a web site that runs under IIS so you can test the web site in that environment. Or, you may want to create and test a file-system web site with the ASP.NET Development Server first, and then test it under IIS later.
How to create a local IIS web site
A local IIS web site is a web site that resides on your local computer. To create a local IIS web site, then, you must have IIS installed on your computer. Please see appendix A for information on how to install IIS.
Figure 4-1 illustrates how you create a local IIS web site. To start, you select HTTP for the location option in the New Web Site dialog box (see the next figure). Then, you typically click the Browse button to display the Choose Location dialog box shown in this figure.
In the Choose Location dialog box, you can click the Local IIS button at the left side of the dialog box to display the IIS web server. Then, you can select the directory where you want to create your web site. In this case, I selected the ASPNET2005 directory. Then, I clicked the Create New Web Application button to create a new web site named Ch03Cart in that directory.
When you use this technique, the files for the web site are stored within the directory you create. If that’s not what you want, you can create a virtual directory that points to the directory where the files for the web site will be stored. To do that, just click the Create New Virtual Directory button in the Choose Location dialog box. Then, a dialog box is displayed that lets you enter a name for the virtual directory and the path where the files for the web site should be stored. In the dialog box shown in this figure, for example, the virtual directory will be named Ch03Cart, and the files will be stored in a directory with the same name within the ASP.NET 2.0 Web Sites directory on the C drive.
In addition to using the New Virtual Directory dialog box to create a virtual directory for a new web site, you can also use it to create a virtual directory for a file-system web site you’ve already created. To do that, just enter the path for the existing web site in this dialog box. Then, when you click the OK button in the New Web Site dialog box, Visual Studio will warn you that there is already a web site at the location you specified. To create a virtual directory that points to the existing web site, select the Open the Existing Web Site option.
Before I go on, you should realize that you can also create a virtual directory for a file-system web site using the IIS Management Console. If you’re interested, you can learn how to do that in appendix A. Unless you need to change the default permissions for a virtual directory, though, I recommend that you create the virtual directory from within Visual Studio.
The dialog box for selecting a local IIS web site

Figure 4-1. How to create a local IIS web site
The dialog box for creating a virtual directory

Description
To create a web site that will run under IIS on your local computer, select HTTP for the location option in the New Web Site dialog box. Then, enter the path of the IIS directory where you want to create the web site, or click the Browse button to display the Choose Location dialog box.
- From the Choose Location dialog box, click the Local IIS button and expand the Default Web Site node. Then, select the directory where you want to create the web site from the default web site and click the Open button, or create a new directory or virtual directory.
- To create a new IIS directory for a web site, click the Create New Web Application button and then enter the name of the directory. The files for the web site will be stored in this directory.
- To create a virtual directory for the web site, click the Create New Virtual Directory button to display the New Virtual Directory dialog box. Enter a name for the directory and the path where you want to store the files for the web site. If the path you specify already contains a web site, you can open that web site from the virtual directory.
Next: How to create a remote IIS web site >>
More ASP.NET Articles
More By Murach Publishing
|
This article is excerpted from chapter four of the book Murach's ASP.NET 2.0 Web Programming with VB 2005, written by Joel Murach and Anne Boehm (Murach, 2006; ISBN: 1-890774-32-4). Buy this book now.
|
|