Back Draft
The IIS7 Difference
By Jonathan Goodyear
When Microsoft releases Windows Vista in 2007 (withLonghorn Server hopefully following shortly thereafter), a lot of newtechnologies are going to be brought to the developer table. I?m sure that you?veheard all about Windows Presentation Foundation, Windows CommunicationFoundation, Windows Workflow Foundation, and Windows CardSpace (formerlyInfoCard), which are packaged into the .NET Framework 3.0 (formerly WinFX) thatwill ship with Windows Vista. I?m excited about all of these things, but what I?mreally looking forward to is Internet Information Services 7 (http://www.iis.net).
You may be wondering what?s so special about InternetInformation Services 7 (IIS7). After all, that stuff is for IT Administratorsto worry about, right? It is true that IIS7 offers many new features for ITAdministrators, but it offers a ton of features tailored for the ASP.NETdeveloper, as well. In fact, my column is not big enough to cover it all. I?mgoing to do my best, though, to hit the high notes of what I feel you shouldknow about.
At its very core, IIS7 has been divided into more than 40distinct functional modules. Some examples are authentication, caching, staticfile handling, and directory browsing. That means your Web server only has tohave installed on it the modules you?ll be using. That reduces its attacksurface, as well as increases server performance, as unneeded modules are nolonger loaded into memory, nor do they need to be part of the request pipeline.Need to swap out a module on the fly? There?s no need to re-boot ? IIS7 won?teven miss a beat.
Speaking of the request pipeline, ASP.NET will no longerbe an ISAPI extension that is merely bolted onto IIS. Rather, ASP.NET will befully integrated into the IIS7 request pipeline (referred to as IntegratedMode), enabling it to intercept and respond to the complete set of IIS events.This core integration also enables ASP.NET features like caching and authenticationto be applied to all file types without sacrificing the performance of mappingnon-ASP.NET file types to the ASP.NET ISAPI extension. The obvious use of thatadded power will be to replace and/or add to the list of modules mentionedabove that comprise IIS7. As an example, you could build your own customauthentication store, state management mechanism, or native image handler,among other things.
Another programmatic enhancement that will come with IIS7is the ability to modify Request headers as they are received. You can alsomodify the Response stream, as well as the cookies collection (even after therequest has been processed by another application). This will enable you toeasily integrate your Web application with third-party Web applications andISAPI extensions that may require low-level editing of data as it is receivedand transmitted. It will also enable you to do things like modify static imagesas they are being streamed out from the Web server. Verycool.
In case you?re trying to do a sanity check, there is aClassic Mode that will enable your ASP.NET application to function exactly likeit does in IIS6. In IIS7, the version of ASP.NET that your Web application usesis specified in the application pool to which it is mapped. This change inphilosophy prevents the problems that occur today when multiple Web sitesrunning on different versions of the .NET Framework are mapped to the sameapplication pool (crashing whichever one attempts to load second). There areonly a few situations where you?d want to revert to Classic Mode, though. Theway that impersonation is handled in Integrated Mode is slightly different, sothat might be a reason you?d want to stick with the old model.
I?m really pumped up about the configuration story inIIS7. Everything is stored in simple to read XML files. There are no moreconfusing bitmasks or integer values. In fact, there?s no more Metabase,although scripts that you?ve created to modify it will continue to run withoutmodification, as IIS7 will map settings to their proper place in the newconfiguration system. The main IIS configuration file is calledapplicationHost.config and is located in the [systemroot]\system32\inetsrv\directory. It inherits settings from the machine.config file that we all knowand love. There also is a root-level web.config file containing global ASP.NETapplication settings that inherits from machine.config andapplicationHost.config. Located in the[systemroot]\Microsoft.NET\Framework\versionNumber\CONFIG\ directory, thissetup makes deployment from development to server, and from server to server, asnap. In addition, web.config files can be stored on a separate file server andreferenced by multiple Web servers. Not only that, IT Administrators can nowdelegate some Web server settings, down to the individual Web applicationlevel, which would then be stored in its web.config file. As an example, wouldn?tit be great if you could specify a default document in web.config, instead ofhaving to dig through IIS Manager (if you even have access to it)? Web hostingproviders are going to love that kind of flexibility, as it will pushapplication-level responsibilities down to the developer level ? where theyshould be.
As if storing all the IIS configuration settings in XMLfiles wasn?t enough, there is now a completely new API for managing them, whichis fantastically easy to use. It?s all contained in theMicrosoft.Web.Administration namespace. For instance, here?s a little snippetof C# code to add a new Web site:
ServerManager iisManager = new ServerManager();
iisManager.Sites.Add("NewSite", "http",":80:", _
"d:\\domains\\NewSite");
iisManager.Update();
I think we can all agree that the user interface for theIIS Manager tool is a bit out-dated. The mantra of IIS7 is to keep everythingmodular, and the new IIS Administration tool is no exception. IIS7 introduces acompletely new interface with a very browser-like feel. The layout of theinterface is very intuitive, and is also extensible, enabling you to build andplug in your own screens to administer existing Web server functionality or newfunctionality that you build yourself.
There are a couple of additional IIS7 features that I feelwarrant mentioning. First, the ASP.NET Tracing features can now be integratedwith the IIS logging features to provide a single, consolidated place to go fordiagnostic information, reducing the time it takes to troubleshoot serverissues. Second, the version of IIS7 that comes with Windows Vista will nowallow multiple Web sites to be configured at the same time. This is a bigimprovement over the single Web site limitation of IIS 5.1 that sits on WindowsXP Professional. Not only that, but while there is still a limit of 10concurrent connections on the version of IIS7 that comes with Windows Vista,the overage will not be denied. Rather, they will be placed on the requestqueue and processed in order.
There is no way I could adequately cover in one column allthe new and exciting features and functionality that IIS7 will bring to thetable when Windows Vista and Longhorn ship. However, I touched on the thingsthat matter most to ASP.NET developers like you and me. As an entrepreneur, I?malso always looking for ways that upcoming Microsoft technologies will spawnnew product markets. Two years ago, I felt not enough people were buildingcustom ASP.NET modules (see http://www.aspnetpro.com/opinion/2004/04/asp200404jg_o/asp200404jg_o.asp).A big reason for that was because we didn?t have access to the entire IISrequest pipeline. I believe that the modular architecture of IIS7, and the wayin which its core is tightly coupled with ASP.NET, will create a greatopportunity for the third-party custom IIS and ASP.NET module market to come tofruition. I am also quite confident that IIS7?s module architecture will enableMicrosoft to release enhancements and patches more quickly and easily than withprevious versions of IIS. It may seem far off now, but IIS7 will be here beforeyou know it, so get coding!
Jonathan Goodyearis president of ASPSoft (http://www.aspsoft.com),an Internet consulting firm based in Orlando, FL. Jonathan is MicrosoftRegional Director for Florida, a Microsoft Certified Solution Developer (MCSD),and co-author of Debugging ASP.NET (NewRiders). Jonathan also is a contributing editor for asp.netPRO. E-mail him at mailto:jon@aspsoft.comor through his angryCoder eZine at http://www.angryCoder.com.