Note: This blog post is from 2007. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.If you use IIS on XP, have you ever wished you could put your code in one directory and run it against different versions of CF, easily. In this note, I show you how.
Someone asserted on a list that some code failed as of CF8, but I tested it against 8, 7, 6, and 5, and it worked the same in all. Hearing that, someone else asked, "Charlie, are you running all those on the same machine or on vmware?"
I assume that the reader, like many, is using IIS on XP, which doesn't let you have more than one web site, which might seem to make it impossible, though some may know the tricks I'll mention.
Of course, folks running on Apache, or IIS on Win2k3 or Win2k Server, would just say, "create different web sites, and install each CF version into a different web site".
Fair enough, but how do you solve this using IIS on XP (or Wink2 workstation), if you can't have multiple sites? That's what I explain below.
Before I go on, though, let me make an important for those who may not be aware: you certainly can run multiple versions of CF on a single machine. They each get installed in their own directories, with their own JVM (as of CF6). The challenge is just to avoid port conflicts and external web server conflicts.
But why not just use the built-in web server?
Sure, if you use the built-in web server available in CFMX since 6, then you can indeed run multiple CF versions each with their own web docroot without conflict.
But that's not the point here. That would cause each CF instance to have its own wwwroot, and you'd have to put your code there to run it on that version.
And I have even explained in a recent blog entry that you can get around that using virtual mappings in the JRun web server, pointing to the shared document directory. But sometimes you really want to use IIS for some reason, or you just don't want to have to remember to use the right port and virtual directory name configured for the built-in web server.
But you can have multiple web sites in XP, if you know how...
Yep, some will want to note that you can indeed create multiple web sites in XP, if you use the right tools. I've written about such tools before. It's just that you can't run them at once, so you have to enable/disable each time you want to run the test. To me, that more of a hassle than just doing the one-time configuration which I discuss below.
So how do you configure things using IIS on XP?
OK, I hope I've headed off complaints some may have. Oh, well, I should add one more: what I'm about to show you is definitely not supported by Adobe. Some might even argue against doing it. Certainly, if you have problems with things while trying to work this way, they're going to tell you to use a vanilla setup.
Still, it's worked for me for years. In fact, I first wrote about it in a CFDJ article back in Sep 03 (co-authored with Jeff Houser). That was written in the timeframe of people moving from CF5 to CFMX and wanting to set things up this way, but the concept still applies even for those moving from 7 to 8, or 6 to 7. It also mentioned using the same approach for running against BD as well, which means it would apply also to Railo and Smith, etc.
Finally, since writing that article, I've also realized a few things I could have added to the article, which further motivates me writing this entry.
How I set things up
So, as explained in the article (which shows you the actual steps in IIS), I configure different IIS virtual directories called _cf5, _cf6, _cf7, and _cf8. I set each to points their CFM extension (and related CF ones) to the appropriate web server extension that would be used if I'd configured each server to work with IIS (like C:\CFusion\BIN\ISCF.DLL for 5, C:\CFusionMX\runtime\lib\wsconfig\1\jrun.dll for 6, and so on).
More important, I have them all point at the same, single document root (in my case, c:\inetpub\wwwroot). That allows me to then run code in that single directory against different editions, using a url like http://localhost/_cf5/somefile.cfm, or http://localhost/_cf7/somefile.cfm, or the default http://localhost/somefile.cfm goes against CF8.
Note that you must run the web server connector for each CF edition from CFMX and above, since it only builds those jrun.dlls (I mentioned above) if you do that. See the CF docs ("Installing and Configuring ColdFusion" to learn how to run that, even after CF is installed, if you installed it using the built-in web server instead.
Before you do, though, as explained in the article, be sure to save off the path to the DLL for .cfm file extensions, as running the configuration tool will wipe over the previous path.
Some concerns using the CF Admin in this setup
There's something else to take note of about using the CF Admin (/cfide/administrator/index.cfm) when you set things up this way.
It has to do with whether, when you install each version, you tell CF to install using the built-in web server or using IIS.
In the former case, CF will put that version's CFIDE directory (and all its related files) into the wwwroot for that built-in CF server, such as c:\coldfusion8\wwwroot\ for CF8, or c:\cfusionmx7\wwwroot\ for CF7.
In the latter case (if you tell CF during installation to use IIS), then CF will place those files into the IIS docroot you name. Assuming you would always choose that c:\inetpub\wwwroot directory, that means that its CFIDE directory will be replaced with whatever is the last CF version you install.
And that means that even if using the virtual directories above, they'll all point to the last CFIDE version, which won't work (the CF Admin can only run in the version for which it's created).
Either way, you can solve this by creating yet another virtual directory, for CFIDE, inside the version-specific virtual directories above.
So if during the installation of 6, 7, or 8 you told CF to use the built-in web server, you'd point the new CFIDE virtual directory to the builtin web server's CFIDE. For my _CF6, for instance, I'd create a CFIDE virtual directory within that to point at c:\cfusionmx\wwwroot\CFIDE.
If instead you choose to install each version using IIS, then just as you needed to save off the file extension's path to the web server DLL, you would similarly need to remember before each install to save off a copy the CFIDE directory for the previous release. This is especially key for CF5, since there is no concept of a built-in web server for that.
Back when I installed CFMX 6, before doing so, I copied the CFIDE directory to call it CFIDE5 instead. (Sure, you could do a rename, but only JUST before you installed, in case you need it.) Then I created the CFIDE VD within the _CF5 VD to point to that.
It may be worth noting here that if you do install CF 6/7/8 using the built-in web server initially, and then use the web server configurator tool to then connect them to IIS, that does not move the CFIDE from the built-in web server root to the IIS docroot. So again you will need to point your CFIDE virtual directory to that CFIDE in the built-in web server.
Why not just use the built-in web server for the CF Admin?Of course, you could just use the built-in web server to access the Admin instead, even if you are otherwise running code via IIS.
And going back to the original writer, you could indeed also do this using VMWARE. (I've written about how versions of it and Virtual PC are now free.) It might be overkill, though. Again, you don't need to worry about running multiple versions of CF on a single server. It's all just about avoiding port conflicts and potential external web server conflicts.
That's what this has been about all about: how to run all your code via IIS against multiple version of CF, all from a single directory.
ConclusionDid this help you? Let me know. Did I forget something? Got a complaint? (People seem to love that opportunity. Go for it.) I hope it has helped some of you. It's certainly helped me, and others who I've shown it to.
For more content like this:
Need more help with problems?
- Signup to get my blog posts by email:
- Follow my blog RSS feed
- View the rest of my blog posts
- View my blog posts on the Adobe CF portal
- If you may prefer direct help, rather than digging around here/elsewhere or via comments, I can help via my consulting services
- See that for more on how I can help a) over the web, safely and securely, b) usually very quickly, c) teaching you as we go, and d) with satisfaction guaranteed