Beware Coldfusion / mapping

Be careful when setting up a root ColdFusion mapping, where the ColdFusion root and the web server root are not the same location.

On our standard Development machines, we are running IIS on Windows XP, and have been developing against 3 versions of ColdFusion.

We set up 3 IIS virtual directories (/cf5, /cf6, /cf7) each pointing to a subdirectory of our sites folder (c:\sites\cf5, c:\sites\cf6, c:\sites\cf7 etc.) - with the corresponding version of CF handling each virtual folder.

Within each version of CF, we set up a root mapping - e.g. for CF7: / = c:\sites\cf7, in order to allow the CF Mapping path to be consistent between development machines and production servers.

This works fine for most occasions - the IIS virtual directory normally has nothing to do with the CF Mapping - however there are a couple of exceptions:

  • Using the Application.cfc OnRequest Method: (CF will set arguments.targetpage to equal the IIS path)
  • When attempting to invoke a CFC as a webservice (error: Could not resolve CFC datatype)

Both of these issues can be resolved by setting up a CF mapping to match the web server virtual directory mapping (e.g. /CF7 = c:\sites\cf7)

Comments
Tom's Gravatar The root mapping is also the path you need to use if you're going to apply a site-wide error handler or a 404 handler.
# Posted By Tom | 19/10/07 13:47
BlogCFC was created by Raymond Camden. This blog is running version 5.5.1, hosted by TalkWebSolutions.