Uh Oh, I Can't Create an ASP.NET Project
A couple of times a year, I start working with a new customer. Generally, each customer has a slightly different work environment and tools. Some have Clearcase. Some have Visual SourceSafe. Some are using the latest version of a compiler, and others are using an older version. Often, the customer prefers that I work with their hardware and software, which means I am using a machine configured by someone else.
Ideally, these PCs and servers would have a complete setup for a software developer, but this is seldom the case. More often, the computers have a basic configuration and I have to install developer tools, which might include IIS, Rational Rose, VS.NET, Clearcase Client, VPN tools, database clients and servers, and much more. Occasionally, I assume erroneously that a developer's box will have IIS and FrontPage Server extensions installed even if VS.NET hasn't been installed yet. But, you know what they say about assumptions.
After having to cope with VS.NET being installed without IIS a couple of times, I decided to write down how to recover from this omission so that I wouldn't have to remember it or rediscover it if it should happen again. Here are some of my notes.
You Can't Create an ASP.NET Web Application or Web Service. What Do You Do?
You're trying to build an ASP.NET Web Application or XML Web Service for the first time and Visual Studio .NET informs you that it is unable to create a Web project of either of these types. This can often indicate that ASP.NET was not installed correctly.
ASP.NET may not install correctly, or you may not be able to create a Web-based solution if IIS or FrontPage Services weren't installed before VS.NET was installed or a Web server with ASP.NET is not accessible. To correct the problem, we need to perform some specific diagnostics steps and then complete applicable corrective measures.
Diagnosing and Fixing the Problem
The first thing we want to do is ensure that ASP.NET is installed on the PC on which we want to create a Web solution. Generally, it is desirable to build, test, and debug Web applications (including Web Services) on your development machine and then deploy to your actual Web server. However, whether you follow this advice or not does not change the diagnostic step.
Is IIS Installed?
To determine whether IIS is installed, we can try a couple of different things. Proceed to the keyboard of the computer on which you are trying to create a Web application. Try any of these things:
- Open Internet Explorer and type http://localhost. If some kind of page or a blank page with no errors is displayed, IIS is installed and running. If you navigate to the virtual Default Web Site and the VCR-like Play button is black, IIS may be installed but not running. Try clicking the Play button (Action|Start in the management console menu).
- Click Start|Run and enter C:\Windows\System32\inetsrv\iis.msc in the Run dialog. If the console fails to open or opens but appears blank, IIS may not be installed.
- If you are not the technical administrator for the computer, ensure that it is not running the Apache Web server or something else.
- Finally, look in the Windows Components Wizard and make sure that IIS is checked (see Figure 1). This feature is accessible from Start|Control Panel|Add Remove Programs|Add/Remove Windows Components.
Figure 1: If IIS is installed, it should be checked in the Windows Components Wizard dialog as shown.
If Internet Information Services is not checked, you can install it from this wizard. You may need the original operating system media (your Windows XP install disk) to add this service, and you will need to re-boot when you are finished. After checking Internet Information Services, click Next. The install process will begin. Follow and comply with the prompts generated by the install process.
If you had to install IIS and VS.NET is already installed, you will want to re-install VS.NET. Instead of un-installing and re-installing VS.NET, insert Disk 1 of VS.NET and select the repair/add features option. This is generally faster and works just as well as a complete re-install.
After you have installed IIS and re-installed VS.NET, we need to install and register ASP.NET. A utility for this purposesomeone at Microsoft must have forgotten to install ISS first, toois installed with VS.NET; it's called aspnet_regiis.exe.
To register ASP.NET, open the Visual Studio .NET Command Prompt. This is an option installed with Visual Studio .NET on the Tools item. This menu item runs cmd.exe and a batch file that sets some path information relevant to VS.NET.
At the open command prompt, type aspnet_regiis -i. You should see two lines separated by a modest delay that indicate ASP.NET is being installed and has completed. After you have finished this step, you should be able to create and host Web applications and Web Services on your workstation or the PC we have been fiddling with.
If you still can't create an ASP.NET solution, give the next section a quick read. Otherwise, see you in a few weeks.