Data Centers

Ride the platform wave: .NET 1.1

What does the release of VS.NET 2003 and .NET 1.1 mean for Microsoft developers? The biggest impact could be in the small details and the power of IIS6.


It's finally here—the .NET Framework version Microsoft would have released first if you hadn't been so impatient. That's right; .NET 1.1 has arrived, along with a new OS to serve it up on and a new IDE to build it with. Microsoft celebrated three years of hard work with the release of Windows Server 2003, Visual Studio .NET 2003, and.NET Framework 1.1. Microsoft calls this the first of its three "platform waves." The other two are centered around the Yukon SQL Server release, due in 2005, and the Longhorn desktop release, due in 2007, which will more than likely prove the death knell for the Win32 API. This first platform wave will allow you to build even better applications than you could with version 1.0. Read on, and I'll show you how.

Development as a house
I've always thought that building an application is similar to building a house. Viewed that way, Windows Server 2003 is the most solid foundation money can buy. And with the new Web Server Edition, you won't have to spend a whole lot either. At the center of Windows Server 2003, at least in the developer world, is IIS6. Microsoft pulled out all the stops and completely reengineered IIS from the ground up. To make a long story short, Microsoft separated the site request processing from the service management. This means that the server management process can now actively manage the resources the sites are utilizing, without a bad site bringing down the whole process. And IIS6 was designed specifically for .NET Framework 1.1, which is built right into the OS.

Another great feature of IIS6 is the concept of the application pool. Application pools further separate applications from each other. The new IIS can host up to 2,000 application pools, and each pool can have multiple apps. If you're a hosting provider, you may use application pools to group customers; a large organization might have one pool per department. This means that a site in one app pool can't take down a site in another.

I don't have space here to delve into all the IIS6 features, but among the most notable are the built-in POP3 service (that's right friends, no more separate mail server), secure-by-default installation (services are disabled until you enable them), and UDDI (Web services directory). In addition, most of Windows Server 2003 is exposed to Windows Management Instrumentation (WMI), which you can query just like SQL.

There's a reason it's called the Framework
You can't build a house without putting up a frame. Fortunately, Microsoft has already done most of the work with the .NET Framework. Weighing in with more than 3,000 predefined functions, most of the stuff that we used to have to do ourselves (like build tables from recordsets) is now done for us.

This new version of the .NET Framework, however, is not an upgrade. I cannot stress this enough. This may be a confusing point for many developers, but it is the cornerstone of .NET and worth your time to understand. Installing .NET 1.1 will not overwrite 1.0. They were designed to coexist on the same machine at the same time. This is called "side-by-side execution," and since we developers love acronyms almost more then the U.S. Air Force, it's also referred to as SxS. The reason to keep them separate is simple. An application compiled to 1.0 will run on 1.0 forever. You won't have to worry about 1.1's assemblies overwriting (and possibly breaking) stuff that already works.

Now, here's how the compatibility issue plays out. If a 1.0 application is called on a computer that has only 1.1 installed, it will try to run without any configuration changes. Nine times out of 10, it will run fine, because Microsoft tried not to do anything that would break old code unless they had to. If a 1.1 application tries to run on a computer that has only 1.0 installed, it will not run by default. You can try to coax it into running by adding the following information inside the <configuration> tag of your config file, as shown in Listing A.

If you are not using any Framework 1.1-specific code, such as anything in the System.Data.OracleClient namespace, you should be good to go. As always, be sure to thoroughly test your application before deployment. In the new two-Framework world, I would also recommend that all of your apps ship with, at minimum, the <startup> section of the code in Listing A.

Almost as good as Bob Vila
Every construction project needs a good contractor. When building a house, if you want the best, get Bob Vila. When building an app, if you want the best, get Visual Studio .NET 2003. Now, before I get into what VS.NET can do, I'm going to tell you what it can't do. Just as 1.1-compiled assemblies can't run on 1.0, VS.NET 2003 can't compile assemblies to use the 1.0 runtime. Conversely, you cannot get VS.NET 2002 to compile to 1.1 of the Framework. Most people will assume that they can just install the .NET Framework 1.1 runtime and be on their way with their existing copy of VS.NET. It doesn't matter what you do. VS and the Framework are like newlyweds; for better or worse, they're inseparable. The good news is that Microsoft will be offering a $25 SxS for current VS.NET 2002 users, so there is pretty much no reason for you not to get the newer version.

Notice in my last statement I did not say upgrade. An upgrade implies that existing software is replaced by newer software. VS.NET 2003 is more of a sidegrade, because it will run SxS with VS.NET 2002, just like the Framework. If you can afford the 3 GB of hard drive space needed for the two versions, I would highly recommend installing both on your computer, since 1.0 will still be around for awhile.

More changes
In VB.NET, you can now declare variables right inside loops. Confused? Let me explain. In VB.NET 2002, if you wanted to loop through, say, a DataSet, you had to write code like Listing B.

Looks fairly simple, right? Well, VS.NET 2003 makes it even easier. Take a look at Listing C.

Isn't that much cleaner? Each variable's scope is limited to the loop it's instantiated in, so you can reuse the variable in your code inside other loops. I would recommend that you don't, to keep code confusion to a minimum, but that's never stopped anyone before.

VS.NET 2003 includes new productivity enhancements as well. For example, when you create a class that implements an interface, as soon as you hit [Enter] to start coding, it will automatically drop in all the interface methods you need to implement. The same thing happens for Try/Catch statements. When you type Try and hit [Enter], the following pops in for you:
 
    Try
    Catch ex As Exception
    End Try

 

The coolness continues. VS.NET also keeps track of your most recently used members. When you type .Text for a textbox, it becomes the default property that is selected via IntelliSense, which is a nice timesaver. But VS.NET offers more than just productivity changes. The new Add Web Reference dialog box is much cleaner, allowing you to specify your own namespace right within the dialog box instead of that "com.microsoft.webservice" stuff that gets really annoying. In addition, you can develop apps for the Pocket PC by using the .NET Compact Framework (.NETCF). Don't have a Pocket PC to test it on? That's okay. VS.NET now has a built-in emulator that operates exactly like a Pocket PC—right down to installing the Compact Framework on the device when you install your app.

More resources


Words of caution
Take advantage of this sidegrade and don't do what I've seen some people do—remove Framework 1.0 after installing VS.NET 2003 and still expect VS.NET 2002 to work. It won't. And don't assume your hosting provider has installed 1.1 on your Web server yet. Make sure you ask first, because you'll be in for a rude awakening when your killer app won't run on a production server.

 

Editor's Picks

Free Newsletters, In your Inbox