.Net is Microsoft's new framework for Internet development, yet most public discussion has focused on C#, the new programming language, at the risk of ignoring .Net's many other aspects. .Net is significantly more than just C#. It incorporates serious changes to VB.Net as well as a host of improvements on the server side. Many of these changes are beyond the scope of this article, though the following tips will help you set up your own .Net test machine and enable you to prepare a simple database in Microsoft SQL with which to experiment.
To run a .Net test machine, we suggest using a standalone box capable of being reformatted a couple of times. While .Net can run on all Windows operating systems from 95 onward, it's best installed on a 2000 machine running Internet Information Server 5.0. Recent release information regarding the beta 2 version announces that full development will be functional only on Windows 2000 or XP. Windows 95, 98, and Me will be runtime-only versions. Additional software required includes Internet Explorer 5.5 and the latest MDAC (currently version 2.6).
In addition, you should have at least a 10GB hard drive and 256MB of RAM. It will run with less memory, but not as well. Remember, if you are installing .Net on anything less than a server level install of Windows 2000, you will have limited use of IIS and MS SQL, since the two applications have been bottlenecked to keep them from being used as production machines.
To install .Net, you must first have the .Net Framework installer. The framework is currently in beta 2 and is available on CD-ROM to MSDN subscribers, either included in the Visual Studio Demo or via download from the Microsoft MSDN site. Visual Studio is not necessary to work with the .Net framework, but it does include massive amounts of documentation, which comprises most of the two-CD installation.
Once again, the test machine should be running Windows 2000 Professional. At this point Microsoft's Personal Web Server has been assimilated into IIS and is no longer available. Instead, the server detects the OS version and bottlenecks itself. This turns out to be excellent in terms of learning IIS, as only the number of connections changes from the free install to the production install. IIS is also available for download from the MSDN site and on the Windows 2000 CD-ROM.
Before you install anything, make sure that you are logged on as Administrator (or you have an account with administrative privileges). The initial installation of IIS doesn't require much configuration, especially as this is not a production server. There are a few settings that you may want to configure. Go to
Start › Settings › Control Panel › Administrative Tools › Internet Services Manager
From here, you can set the IP address for the server (General tab), as well as enable items such as Directory Browsing (Home Directory tab). To test your installation, open Internet Explorer and type http://localhost/ into the location bar. The IIS introductory message, as well as links to further IIS resources, should load into the browser.
Note: If you are installing this on Professional or any other nonserver version of the Windows OS, you need to enable the Personal Web Server to allow directory browsing. Do this by going to
Start › Settings › Control Panel › Administrative Tools › Personal Web Manager
Next, enable Allow Directory Browsing under the Advanced tab. Lastly, open up the root directory under the Web server (default is C:inetpubwwwroot) and rename iisstart.asp and localstart.asp to iisstart.txt and localstart.txt, respectively. This pair of files provides the setup and welcome message for IIS 5.0. You could delete them, but it's wise to keep the originals as backups.
Installing MS SQL 2000
The MS SQL install is as straightforward as the IIS install, though you still need to be logged in as Administrator on the system. Simply insert the CD-ROM and follow the pop-up instructions. The two primary items of note are to set SQL to run as a service and to have data reside on a different drive (if available). In the event that you do not have access to MS SQL, the .Net Framework SDK will install the MSDE from Microsoft. There are methods for working with this using the client tools for MS SQL and Access or by inserting a prebuilt database into MSDE. These have all been discussed on the Builder Buzz at various times.
If you are in the process of learning MS SQL at the same time, be aware that the .Net install will most likely overwrite the Northwind Traders demo.
Installing .Net Framework SDK
The .Net Framework SDK takes some time to install. It may even appear to pause at a number of intervals. My own tests have determined that the quickest installations take an hour. I have found the install time to be consistent on either a 433MHz Celeron with 256MB of RAM and two 30GB hard drives or a 700MHz Celeron with 128MB of RAM and a single 10GB drive. In general, the installation time lessens as CPU, RAM, and hard drive power increase. In addition, once the CD or download is complete, you are only half finished. After the first round of installation—which is completely menu driven—you need to locate the .Net Framework SDK Overview icon on the desktop and double-click it to begin the documentation and samples installation. An IE window will then open, prompting you to:
- Select the samples installation.
- Choose to expand the samples.
Note: If you do not have MS SQL, you will need the optional install of the MSDE.
Choose Complete The Setup to finish the installation. This particular step compiles a number of virtual directories in your IIS installation, then imports two other databases into the DB engine. This step uses Nmake to perform most of its work and unfortunately tends to produce the largest number of problems. Make sure to let Nmake run completely, and in the event that it doesn't complete its run or something goes awry, just run it again. It will take somewhere between 15 and 20 minutes to complete.
Once Nmake has finished, you should be able to refresh the installation Web page to include a list of the samples. An easy way to see if everything has been correctly installed is to enter http://localhost/quickstart/aspplus/samples/portal/default.aspx. If the portal demo actually loads up, then the .Net Framework is installed. In the future, you'll be able to open your Web browser and enter http://localhost/quickstart/ to access all of the samples, lessons, and documentation for the .Net SDK.
Now that we've completed the full installation and everything is working correctly, we can begin creating a demo database to work with our future columns.
Developing the demo database
First, load up the MS SQL Enterprise Manager. The demo database we'll create here will be a fairly simple music archive. The structure of the database will contain three tables: Artist, Album, and Song. If you're not familiar with MS SQL, look into the latest Wrox Press book, Beginning SQL Server 2000 Programming. Also, if you're feeling lazy, download the database here.
Under the tree in Enterprise Manager, right-click the Databases folder and select New Database. Name the database Music, then prepare to begin making tables. We'll have three tables, but for now, let's start with Artist. Right-click the Music database icon and select New › Table. We'll keep it fairly simple, with just three fields: ArtistID (int) as the Primary Key, followed by Artist and Genre (both varchar 50). The Album table will have AlbumID (int) as the PrimaryKey, ArtistID as the Foreign Key, Title (varchar 50), and ReleaseYear (int).
Here, you'll notice that we cheated and didn't use a date type for the year. Since we're not keeping precise dates, we don't need to specify a type. The final table contains SongID as the Primary Key (int), AlbumID (int) as the Foreign kKey, SongTitle (varchar 100), and SongLength (varchar 10).
Next, we need to populate the database. In this step, you may want to use the downloadable backup to add some data, or you can start by adding your own music into the database. Once the data has been populated and the database closed out, the final step is to create a system DSN for the database, like so:
Select Start › Settings › Control Panel › Administrative Tools › Data Sources (ODBC)
Choose the System tab and add a new SQL Server driver. When following the wizard, you'll need to name the DSN as well as provide a description and the SQL server to connect to. Since this is just for learning and won't actually be produced, select Windows Authentication and click Next. You then need to set the default database, which is, in our case, Music. Then click Finish to complete the settings. (You may have to click Next, then Finish.) The last step is to test the database connection.
That covers the introduction and installation of the .Net Framework SDK with its own demo database. In the next article, we will cover accessing, publishing, updating, and deleting information from the database.