|
|
|
This lesson does not correspond to any chapter in the text. However, it's a valuable resource to help you get IIS up and running on your home machine! WEB SERVERS AND YOU Web servers run special software to support HTTP, FTP and mail access. Microsoft's Web server is Internet Information Server (IIS). You need IIS on the computer you're developing ASP.NET pages because you should NEVER do your development on the actual server that will be hosting the site. Errors could lead to server crashes. Using other applications might slow down the server. You might even accidentally overwrite your entire site. The bottom line is that you should perfect your Web site on a development computer. Only then should it be uploaded to a live server. In order to create ASP.NET applications on your PC, it must act as a Web server. You will access your ASP.NET pages just as you would over the Internet, by entering a URL into your Web browser. ASP.NET pages will be accessed by IIS and processed by the ASP.NET engine. The only difference between your local PC and a traditional Web server is that your PC won't be accessible over the Internet. IIS is included with Windows NT, Windows 2000 and Windows XP Professional or greater. PWS will not work with ASP.NET pages. Therefore if you don't have one of the operating systems listed above, you can't create ASP.NET sites unless you use the free ASP.NET Web Matrix. You can always look for a free host to test your pages. It looks like DevBizHost.com might offer free hosting, but you should check into it before wasting your time. IIS is not installed by default. You should make sure it's installed before installing the .NET Framework or Visual Studio.NET. Otherwise you have to run the two installation scripts Once IIS is installed a virtual directory is created at C:\Inetpub\wwwroot. If a file named localstart.asp is found in that directory, IIS is up and running. You can't double click on this file to run it. It must be executed through IIS by requesting it using a URL. You can double click on an HTML file in Windows Explorer because it does not need to be accessed through the Web Server and compiled by ASP.NET. Since you are running IIS on the same computer you are accessing the page through your Web browser, you can refer to your machine in the URL by using one of three different methods.
If IE gives you an error message that states you are working offline, click the Connect button. As stated earlier, you use virtual directories to access ASP.NET pages through IIS. A virtual directory is a URL path that corresponds to an actual physical directory on the hard drive. Follow the directions on the bottom of page 87 to create a new virtual directory.
Enter the name of the virtual directory. I named mine SteveWeb.
Choose the physical directory where the ASP.NET files will be stored.
Set the permissions: Permissions:
After you're finished, the virtual directory appears in the tree view. The files currently located in the directory are displayed on the right pane. You should really create a new folder for your physical directory so when you create your virtual directory the right pane is empty.
VIRTUAL DIRECTORIES AND APPLICATIONS You access and manage your virtual directories by clicking the plus sign next to "Default Web Site". You'll notice four different icons.
FOLDER SETTINGS Permissions are set on a folder by folder basis. If you want an application to have different settings, you should create subfolders and apply special permissions to the subfolders. To set the options for a directory, right click on it in IIS and choose Properties.
The Virtual Directory tab is the most important. Many of the permissions here were set by the Wizard, but they can be overwritten in the properties window. You can only change a virtual directory's corresponding physical directory if you are not browsing a subfolder's properties window. You can click the remove button to turn the Web application back into an ordinary Web folder. You can click "create" to turn an ordinary Web folder into an application. Changes made to a virtual directory trickle down to the subdirectories. If you want to make a change that affects all applications, change a setting in the Default Web site. If you are overriding custom settings, you will be warned. FILE MAPPINGS Since you can run ASP and ASP.NET on the same machine using IIS, how does IIS know which technology should be used? ASP and ASP.NET use different file extensions. ASP pages use a .asp extension and asp.net pages use an .aspx extension . There are other extensions associated with both technologies. These can be viewed by clicking the configuration button on the Virtual Directory tab. The extensions associated with the .NET framework are ASP.NET extensions.
Although both technologies can run on the same machine, they do not integrate well. They cannot share session state since they run in separate application processes. ADDING A VIRTUAL DIRECTORY TO NETWORK NEIGHBORHOOD If you double click an ASP.NET file from Windows Explorer or My Computer, it will open the associated page editor. If you want to click on a file and execute it, you must add the virtual directory to Network Neighborhood.
INSTALLING ASP.NET There are three different ways to install ASP.NET
If you receive a message that you are missing Microsoft Data Access Components, stop the installation and download the latest version of MDAC. MIGRATING FROM ASP Migrating ASP pages to ASP.NET is not easy. There are three ways you can cope with this issue:
|