Web applications involve communication between multiple computer programs, specifically the Web browser and the Web server. Usually these programs reside on separate machines connected to a network. As you might imagine, problems can arise if your Web server or network is not configured correctly. In this section we will discuss some basic troubleshooting steps that may help you with common problems. For terminology purposes, we will refer to the PC on which you have installed Visual Studio .NET as the development machine and the PC or server running Microsoft Internet Information Services as the Web server. These may or may not refer to the same physical computer. The term browser refers to the Microsoft Internet Explorer Web browser. Note It is acceptable to run a Web server on your development machine for testing, especially if you are uncomfortable with making configuration changes. However, for serious team development efforts or when publishing the final product, you will need to have a separate, dedicated Web server. Validating IIS Installation Internet Information Server (IIS) is the Web server program created by Microsoft. It is bundled with many operating systems, such as Windows 2000 and Windows NT, and available as an add-on for others. Note The troubleshooting steps in this section are based on Windows 2000, but can be used as a general guide. The first step in making sure that IIS is installed and running is displaying the home page in your browser. This was described in the earlier section, "Connecting to Your Web Server." Note An "Under Construction" page does not mean anything is wrong with the Web server, just that there are no Web pages published. This is actually a good sign; if you can display an under construction page from your development machine, the Web server is working. If you cannot access the Web server from a browser on your development machine, it may indicate one of the following problems: Internet Information Services has not been installed. There is a network connectivity problem between the development machine and the Web server, or you are using an incorrect Web server address. Installing IIS To determine whether IIS is installed, go to the Web server and display the control panel. Find the Services icon (located under Administrative Tools in Windows 2000). In the list of services, look for the World Wide Web Publishing Service and make sure the status is Started, as pictured in Figure 3.13. Figure 3.13. The World Wide Web Publishing service is not installed by default on Windows 2000 Professional, but can be easily added from the installation CD. If you do not see the World Wide Web Publishing Service listed, you will need to install IIS or use another computer as the Web server. The following steps describe how to add Internet Information Services to a computer that is running the Windows 2000 Professional operating system. -
Click the Start button, Settings menu, and the Control Panel icon. -
Double-click the Add/Remove Programs icon. -
Click the Add/Remove Windows Components icon. -
In the list of components, find Internet Information Services. If the check box beside it is not selected, click it. If the check box is already selected, click the Details button and make sure all of the sub-components are selected. -
Click Next and continue following the onscreen instructions. You may be prompted to insert the Windows installation CD.
When the World Wide Web publishing service is running in the services list as shown in Figure 3.13, you should first try to open Internet Explorer on the server itself and display the http://localhost address. If the browser test is successful from the Web server, try it from the development machine. Checking Network Connectivity If you still cannot connect to the Web server from the development machine, this may indicate a network problem between the two machines. To troubleshoot most networking problems, you will need two key pieces of information: the computer's unique name and numeric network address (known as the IP address). If you are running Windows 2000, perform the following steps to determine this information: -
Right-click the My Computer icon, select Properties, and click the Network Identification tab to determine the computer's name. -
Open a Command Prompt window (under the Accessories menu), type IPCONFIG and press Enter to display the computer's IP address.
Although troubleshooting network connectivity problems in detail is beyond the scope of this book, the simple PING test described next may help. The PING command is often used as a test of network connectivity between two machines. It works by sending a signal to the specified machine and informing the sender if a reply is received and how fast. -
From the development machine, open a Command Prompt window. -
Type PING followed by a space and the Web server name. Press Enter and note the response. -
Type PING followed by a space and the Web server IP address. Press Enter and note the response.
The results of a successful ping test are displayed in Figure 3.14. Figure 3.14. If PING tests fail for both the name and address, contact your network administrator for help. If you have a home network, consult the documentation included with your network equipment. If both PING tests are successful, you should be able to connect to the Web server. If the PING by number is successful but the PING by name is not, you can try either of the following options: Use the numeric address to access your Web server, as in http://192.168.0.1. Locate the HOSTS. file on your machine. Contained within this file are instructions for adding the IP address so that you can access the machine by name.
The World cannot Wide Web has a lot of information about setting up and configuring networks. For example, the Web site http://www.howstuffworks.com/home-network.htm contains some useful information about setting up a network in your home. Installing the .NET Framework The Microsoft .NET framework includes the Common Language Runtime and other important files needed by .NET applications. The .NET framework must be installed on the Web server. If you are using the same physical machine for development and Web services, you already installed it with Visual Studio .NET. If you are using a separate computer than your development machine as a Web server, you may need to install the .NET framework. The .NET framework is a major Microsoft initiative and will probably be included in future operating systems and service packs for the current ones. However, at the time of this writing, it had to be installed as an add-on in the form of the Microsoft .NET Software Development Kit (SDK). To install the .NET framework on a separate Web server, please see the readme.htm file that accompanies Visual Studio .NET. The section "Configuring the Server Computer" contains instructions for configuring a remote Web server for use with Visual Studio .NET. At the time of this writing, we were able to prepare a computer for use as a remote Web server by performing the following steps: -
Install Windows 2000 Professional. -
Add IIS components as described in the previous section, "Validating IIS Installation." -
Begin the installation of Visual Studio .NET. Install the Windows Component Update (Part 1). -
When the Windows Component Update has finished installing, click Server Setup, located in the lower corner of the Visual Studio .NET Setup screen. After clicking this link, you should see the Server Setup screen. Scroll down the list of server components until you see the Web Development section, pictured in Figure 3.15. -
Click the Install button to configure the Web Development components. -
Run Visual Studio .NET setup and install the Remote Debugger. -
Restart the computer.
Figure 3.15. In order to debug Web Applications on a remote Web server, you may need to install the Web Development Server Components of Visual Studio .NET. Note At the time of this writing, we could run Web Applications successfully on a remote machine by just installing the .NET SDK from Microsoft's Web site. However, for remote debugging to work we had to perform the steps described previously. Web Access Modes As you learned earlier in this chapter, the files that make up your Web application reside on a Web server. Visual Studio .NET updates these files on the server when you create or run your Web Applications. There are actually two Web access modes Visual Studio .NET uses to communicate with a Web server: FrontPage Extensions These extensions are an add-on to IIS that allows Visual Studio .NET to access files on the Web server using only the Web server address. File Share Access Requires a network drive connection to the hard drive of the Web server where the application files are stored. If you followed the instructions in the earlier section entitled "Validating IIS Installation" or those in the Visual Studio .NET readme.htm file, you installed the FrontPage Extensions. By default, Visual Studio .NET will attempt to connect using file share access over the \\machinename\wwwroot$\application share. If Visual Studio cannot connect to your Web server, you may see a message similar to Figure 3.16. Figure 3.16. Visual Studio .NET can publish Web applications via the FrontPage extensions or network file shares. Some users or Web server administrators may not want to install the FrontPage extensions on their Web server. This may be due to (unfounded or not) fears of hackers or excessive use of server resources. (However, FrontPage extensions should be safe to install on a development Web server. They are not required for the application to run in production.) For more details on the advantages and disadvantages of each Web access method, see the "Web Access Methods" topic in the Help files. Note Even if you have FrontPage extensions installed, you may run into problems if they are not configured correctly. In addition to the message shown in Figure 3.16, Visual Studio may ask you to configure or check server extensions. To find these options, perform the following steps: -
Right-click the My Computer icon and choose Manage. -
Under Services and Applications, find Internet Information Services and expand the menu tree. -
Right-click the Default Web site in your IIS manager.
The All Tasks submenu contains these options. If you want to access a Web application without using FrontPage extensions, you can use file share access. To do this you must provide a path to get to the Web application directory via the file system. For example, if you are using your local drive, C:\Inetpub\WWWRoot\LoanCalcApp might be the path. If the Web server is a separate machine from the development machine, you will have to provide a path using a mapped network drive or UNC path. |