We recently have been upgrading our CF servers and wanted to utilise the new native support for IIS, removing the IIS6 compatibility that we had to use prior to 9.01.
Now if you have done the install then you will know that the easiest way to set this up is to run through the install and then run the IIS configurator (wsconfig). This java tool uses ASP.NET to setup IIS.
You have an option to add CF to individual sites or All. Now all is a bit misleading as in fact it will just go through the sites individually (but will do all sites). This is different from the CF8 we were using, in that if you selected all it would add the necessary settings at the server level, this meant any new websites created would inherit the CF settings. With the CF9.01 wsconfig tool setting things up per site, it means that every time you add a new website in IIS you will have to run the wsconfig tool.
Now by running the wsconfig tool it is doing a couple of things
1. Adding an IIS config file called web.config to the root of each website folder, it then places the additional CF IIS config in that file. (So you will find a web.config file for each website you run the wsconfig tool against).
2. It kindly adds VDs cfdocs and cfide to all sites…. What this means is that you may find that the CF administration site is available through every single website on your server. For us this was a security risk and a pain as every time the wsconfig tool was run you had to remember to go and clear out these newly created VDs.
In addition for us the web.config file caused us issues with code deployment, as it was not included.
So I started to look for a way to try and get the old functionality back that allowed CF to be set up at the server level and then all sites created would inherit these settings.
I won’t bore you with all the ins and outs, but in essence IIS runs a master config file called applicationhost.config which you should find here
C:\Windows\System32\inetsrv\config\applicationhost.config
Now individual site config can be included in this applicationhost.config file or in web.config files in the root of each website. Now Adobe chose to put there config in the web.config, and I can see why, there is less risk in totally screwing up the entire IIS config.
Now the settings can be applied to site or server levels. So below I show the web.config file that a CF install will create for per site config.
<?xml version="1.0" encoding="UTF-8"?><configuration><system.webServer><defaultDocument><files><remove value="index.cfm" /><add value="index.cfm" /></files></defaultDocument><handlers><add name="JWildCardHandler" path="*" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="None" /><add name="hbmxmlHandler" path="*.hbmxml" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /><add name="cfswfHandler" path="*.cfswf" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /><add name="cfrHandler" path="*.cfr" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /><add name="cfcHandler" path="*.cfc" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /><add name="cfmlHandler" path="*.cfml" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /><add name="cfmHandler" path="*.cfm" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /><add name="jwsHandler" path="*.jws" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /><add name="jspHandler" path="*.jsp" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" /></handlers><staticContent><mimeMap fileExtension=".air" mimeType="application/vnd.adobe.air-application-installer-package zip" /></staticContent></system.webServer></configuration>
So what I wanted to do was move this config to applicationhost.config.
Note: It must be noted that I had run the wsconfig tool once in the initial setup, so you will need to do this once to ensure that everything is initially setup properly for IIS and CF to interface. By running the wsconfig it creates a subfolder in
C:\ColdFusion9\runtime\lib\wsconfig with the more content.
The subfolder is \1\, and contains a few files. These need to be there for the wildcard handler
OK with the Dlls in place, the first thing is to allow IIS to run the CF dlls, this is done in the isapiCgiRestrictionsection of the applicationHost.config file
<isapiCgiRestriction>
<add path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="C:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll" allowed="true" description="Macromedia Server Extensions" />
<add path="C:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" allowed="true" description="Macromedia Server Extensions" />
</isapiCgiRestriction>
Now the applicationhost.config file is huge so I am summarising below, showing where each of the entries will go within that xml file, I have highlighted the added data.
- “xxxxxxxx” indicates there is content in the file that I am not showing
- “………” indicates there is further content in the file that I am not showing
<system.webServer>xxxxxxxxxxx<staticContent lockAttributes="isDocFooterFileName"><mimeMap fileExtension=".323" mimeType="text/h323" /><mimeMap fileExtension=".aaf" mimeType="application/octet-stream" /><mimeMap fileExtension=".aca" mimeType="application/octet-stream" /><mimeMap fileExtension=".accdb" mimeType="application/msaccess" /><mimeMap fileExtension=".accde" mimeType="application/msaccess" /><mimeMap fileExtension=".accdt" mimeType="application/msaccess" /><mimeMap fileExtension=".acx" mimeType="application/internet-property-stream" /><mimeMap fileExtension=".afm" mimeType="application/octet-stream" /><mimeMap fileExtension=".ai" mimeType="application/postscript" /><mimeMap fileExtension=".aif" mimeType="audio/x-aiff" /><mimeMap fileExtension=".aifc" mimeType="audio/aiff" /><mimeMap fileExtension=".aiff" mimeType="audio/aiff" /><mimeMap fileExtension=".air" mimeType="application/vnd.adobe.air-application-installer-package zip" />
1: <location path="" overrideMode="Allow">2: <system.webServer>3: <modules>4: xxxxxxxxxxx5: </modules>6: <handlers accessPolicy="Read, Script">7: <clear />8: <add name="JWildCardHandler" path="*" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="None" />9: <add name="hbmxmlHandler" path="*.hbmxml" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />10: <add name="cfswfHandler" path="*.cfswf" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />11: <add name="cfrHandler" path="*.cfr" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />12: <add name="cfcHandler" path="*.cfc" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />13: <add name="cfmlHandler" path="*.cfml" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />14: <add name="cfmHandler" path="*.cfm" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />15: <add name="jwsHandler" path="*.jws" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />16: <add name="jspHandler" path="*.jsp" verb="*" modules="IsapiModule" scriptProcessor="E:\ColdFusion9\runtime\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />17: <add name="ISAPI-dll" path="*.dll" verb="*" modules="IsapiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />18: <add name="TraceHand........
I hope that is clear.
There is one other settings that we put in to allow coldfusion errors to be displayed, without this IIS intercepts the error status and displays a “friendly message” is stead of of a helpful CF error page. The addition here is just this httpErrors node attributeexistingResponse="PassThrough", I am afraid my highlight only allows entires lines to be highlighted.
1: <httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath" existingResponse="PassThrough">
So with these changes in place in the applicationhost.config file you can remove the web.config files from the website root folders.
As always please back up these files before you start messing with them.
You will need to restart IIS for the changes to be picked.
Now I have not yet tried not running the wsconfig on a new install and then adding these changes to the applicationhost.config file. That is next on my list. When I do I will update here.
Default Documents
To add a default document to all sites, i.e. to add index.cfm, add the bold line to applicationhost.config
<defaultDocument enabled="true">
<files>
<add value="Index.cfm" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
Thanks for the great insite... I have a question for you... If I remove the IIS6 Meta Compatibility then reconfigure all the sites, including some .net sites, will the config tool UPDATE the web.config files or destroy them and overwrite them?
ReplyDelete@LarryRampy, Hi as far as I am aware it should just update them. However I would test this before configuring all the sites.
ReplyDeleteYou should be able to set up a test IIS site and use the config tool against that site.
I did as you suggested and set up a test site, first locally then on the production box. When I tried to delete the CF config instance it gives an error saying "Error deleting IIS application extensions: jsp,cfm etc... from website (name)
ReplyDeleteI close that error and get this window....
It says "if your webserver is running you will need to restart it to complete the removal of the jrun connector" I restart IIS and the CF config instance does not go away and I cant re-configure that site...any ideas?
Hey Allan,
ReplyDeleteI did testing and then pulled the trigger on this and was up till 6:00am working on the fix, eh... as it turns out in the applicationhost.config file this entry failed and brought down every website:
In my install I do not have this tag in the applicationhost.config file ''
That is supposed to be there for IIS 6 Compatibility and in Classic Mode...is that correct?
I am trying to run in Integrated Mode
< add name="AboMapperCustom-89651247" path="*" verb="*" modules="IsapiModule" scriptProcessor="D:\ColdFusion9\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll"
ReplyDeleterequireAccess="None" responseBufferLimit="0" lockItem="false" />
Hey larryrampy, sorry to hear about your late night.
DeleteI assume your testing worked and then you had problems? I take it you got it running again.
You are right about the aboMapperCustom, as I understand it, these should be there only for the CF9 (IIS6 compatibility). I belive IIS7 adds these entries to work with IIS6 settings. So did you remove the aboMapperCustom tags, to get it working.
I wonder why I did not encounter this problem.
I have just been through the process again on another CF8 upgrade and had no issue.
Thinking about it I wonder if running the wsconfig tool for CF9.01 removes the aboCustomMapper entries that would have been put there by the CF9 wsconfig... maybe?
In the server I just setup I never ran the CF9 wsconfig, I applied the CF9.01 install before running the wsconfig tool to create wildcard dll folder. So maybe that was why?
Again sorry to hear about you tails of woe...
I removed just the one tag and everything was working again, it was also the only one mapped to the wildcard... the others were mapped to D:\ColdFusion\runtime\lib\wsconfig\jrun_iis6.dll
ReplyDeleteI was trying to figure out today what the heck happened, I realized possibly the main issue was most likely when I removed all CF configs those tags were left over in the applicationhost.config and were not in IIS ISAPI and CGI Restrictions....
I still have some config issues...everything is working but I need to go back and clean up the old IIS 6 compatibility entries... I still have not been able to run the .net sites in Integrated mode...but I am closer.
On my test site, in Integrated mode, I get this:
Handler:ExtensionlessUrlHandler-Integrated-4.0
Error Code:0x80070032
This may be a bug in .Net 4.0. there is a .net update for this, pretty sure!
Thanks! I appreciate the input!