[Looking for Charlie's main web site?]

How would you run code against multiple CF versions at once using IIS on XP?

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.

Conclusion

Did 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 from Charlie Arehart: Need more help with problems?
  • If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
  • See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
Comments
Thanks for this Charlie. I actually remembered reading your old article on this which is how I have one of my older machines setup but had forgotten the details - this is still very useful particularly as it shows how to also have CF5 running along side the MX versions - now for extra marks (or a bit of fun) would there be anyway to get 4.5 pr 4.5.1 running at the same time ;-)
# Posted By kola | 8/22/07 3:30 AM
Hey Kola, if you mean 4.5 alongside of 5, no. Those two can't co-exist, as before CFMX (6), CF was like most other Windows programs in that you couldn't have more than one version exist at the same time. At least that's my recollection. That's where your idea of using a VM would be perhaps the best option (yes, folks, Kola was the one who asked the question that led to this entry).
Some may also want to consider running a virtual Machine with a full windows 2003 server web edition rather than trying to run windowsXP as a server. This means you have the full power of windows server and IIS6.
The great thing with running a VM is that you only turn it on when you need, and the rest of the time your desktop is just a desktop and does not have any system resources being used. You also do not risk screwing up your desktop or laptop with all these server applications.
Oh and it is also free. Just visit www.vmware.com and download the vmware server, it is really easy to use and to setup. Also Microsoft virtual server is also free I believe.

I would also highly recommend that developers invest in the Microsoft Action pack subscription. Over here in the UK it costs only £299 per year, and for this you get thousands of pounds/dollars in software including windows 2003 server, SQL Server, Office, Exchange and loads more. A better inestment than buying Windows 2003 server by itself.


I should also mention that windows Vista (I had the home premium edition) does not have the same restrictions as windows XP. IIS does allow you to create multiple sites.
Although there is little else I can recommend about Vista. Certainly don't try to run VMWARE on it.
Russ, I guess I want to say again, thanks, but you're repeating some points I'd made. I'd said that using VMs would be an option, and that they are now free, and even pointed to a previous blog entry with more info on that. I also mentioned that some would propose that folks on Win2k3 (or using Apache) wouldn't have the problem in the first place.

All that said, I don't know that we want to call the readers out for "trying to run windowsXP as a server". I don't think that's what we're talking about here. We're referring to developer workstations, not production servers. You say it helps avoid "screwing up your desktop or laptop with all these server applications", but really, I've been doing it for years with no harm.

Still, I do agree that VMs or other platforms may be a better choice for some. And thanks for the mention of the Action Pack (anyone used that in the US, or might it be called something else here?), as well your thoughts on Vista. I've read mixed reviews. Some love it, some hate it. I plan to try it myself soon.
I would say your lucky and one of the few exceptions then Charlie, as most people have to re-install windows fairly regularly, especially if they install a lot of software.
Well, that may be, but then I often get comments from folks who see my laptop during talks, where if I hit the start button and they see that I have about a hundred folders within it, representing one or more installed programs, they often are shocked. Yet, no, I've not had to reinstall Windows for over a year. But anyway, we're going astray of the focus of this entry. I'd certainly argue that just running multiple CF servers in a single XP box isn't all that unusual. I'm just showing how to use VDs in IIS rather than relying only on the built-in web servers.
Charlie,

We have three servers that we need to prevent external access to the ColdFusion Administrator. I have found a few things about blocking access but they all seem complitcated. I've tried just using the directory security in IIS but it didn't work. Do you have any suggestions? It seems like this should be something easily done in the administrator.

Thanks,
Mike
# Posted By Mike | 10/18/07 1:34 PM
Mike,

It is real simple.

In IIS, go to the default web site, right click on the administrator folder and select properties. Now choose the "directory security" tab.
Now click on the EDIT buton under "IP and domain name restrictions".
change the setting to "by default all computers will be denied access".
Now click the add button and add all the IP addresses that you wish to be able to access the cfadmin.
Now no-one except you can access the administrator folder.

You may also find my article on "securing your ColdFusion instalaltion on windows" useful.

http://russ.michaels...
Hi Charlie, how about an update to this excellent article for a Windows Vista SP1 development machine with IIS 7.
# Posted By Ronald | 10/2/08 8:49 PM
Ronald, well, on one hand IIS 7 on Vista should make things easier, because it supports multiple web sites (even for other than Ultimate). That's a nice plus.

If you're running CF8, it's really as simple as using the web server config tool to configure CF to serve any of multiple web sites.

If you're on CF7, unfortunately, it does not support IIS7. You can fudge it manually, by creating a new site and manually updating the appropriate IIS config entries.

In fact, there are instructions along these lines in this article: http://www.community...

The first 6 pages focus on installing CF, which you can skip if you already have it installed. The key info is on pp 6-8.

Also, rather than do some of the extracting and creation of files that it discusses, I was able to use files I had in CF8. I did need to edit those to use the correct port and file location. (Read the article for this to make more sense.)

And while the article was about installing CF7 support for all web sites, I was using the Vista feature to create a new site just to run code via CF7. I applied the changes about handler mappings just in that site, rather than at the top level, as I didn't want to affect my CF8 install.

One last step I needed to do, not listed in the article, was that in the handler mappings I had to remove one of the ones listed for the * path, which was itself set to point to the CF8 module. In my case, it was called AboMapperCustom-32635, but yours may have a different name.
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting