[Looking for Charlie's main web site?]

Working around an issue with CF and IIS 7 (related to .NET)

Note: This blog post is from 2008. 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.
Here's a tip about an error others may hit when configuring CF with IIS on Vista. I'll clarify that I'm on CF8, Vista SP1, and may possibly have installed some .NET 2.0-based apps or products, all of which could have contributed to this issue. YMMV.

UPDATE: I have an update on this: the reason I had the issue was not related to SP1. And it wasn't that I'd "installed a .NET 2.0 app" since I installed Vista. Rather, it turns out that it was because I'd restored from backup some files into my IIS docroot that included a web.config that DID have .NET 2.0 config entries. Even so, this could happen to others, or to others who DO install .NET 2.0 apps, so I leave it for others to consider.

I'd been running Vista for a while on my development machine, and though I'd installed CF8 on it without problem, I chose at first to use the built-in web server to start (both with the standalone and multiserver deployments of the CF8 Developer edition.)

Today I decided to hook it to IIS. Since I'd not made the choice to use IIS on install of CF 8, I of course used the web server configuration tool (start>programs>adobe>coldfusion 8>web server configuration tool). Though I'm on Vista Ultimate and could define more than one web site (a nice bonus of the Ultimate and Business editions all Vista editions, without needing to buy a Server edition of Windows), I had not defined any beyond the default web site. (Update: I spoke today with Bill Staples, one of the folks in charge of IIS 7, about this whole issue, which is when I realized it came about from me doing the restore. Anyway, he said that the support of multiple sites is something in all editions of Vista. Nice.)

(One interesting thing that happened was I got a popup telling me that CF would need a few minutes to configure itself with IIS 7. I took a screenshot of the window that popped up but lost it from the clipboard. Perhaps someone else will see it and can comment here what it says, to help those doing searches later. But as it said, after a couple of minutes it did take.)

Error on first CFM page request

But when I requested my first CFM page, I got a big ugly IIS 7 error page (an HTML page), the crux of which reported:

ASP.NET applications require migration when specifying configuration in <httpModules> or <httpHandlers>.

Yikes. It went on to provide various details on the problem as well as some workarounds. The gist was that the system.web httphandlers entry in the config files had something that was no longer compatible with the new, default "integrated mode" of IIS (defined as the "managed pipeline mode"). What had CF done? How would I best resolve it?

Quick and dirty workaround: Change mode to "classic"

One of the workarounds described changing the "mode" for the "managed pipeline mode" from "integrated" to "classic". This is defined in the site's application pool, which you can modify in the IIS manager (selecting "application pools", then the app pool (by default, the "default web site" uses "DefaultAppPool"). See the screenshot here.

Sure enough, changing it to "classic" made the problem go away, but that may not be the best solution.

Better Solution: Migrating the .NET settings in a single, simple step

I did some digging and found one blog entry with a good bit of info, and he seems to assert that this is just a breaking change in IIS 7 for ASP.NET 2.0 apps.

He also made the case for not using the workaround above (changing the mode to "classic"), as it could cause loss of many of the nifty features that IIS 7 adds. Instead, he proposed that one should instead seriously consider the option to upgrade the .NET 2.0 app config entries to work properly in integrated mode. Turns out this is just a simple command line command:

%SystemRoot%\system32\inetsrv\appcmd migrate config "Default Web Site/"

I had set the mode back to "integrated" to confirm that the error came back (it did), so I then dropped to the command line (using start>run and entering "cmd") and pasted that line verbatim (right-click and paste, not ctrl-v) onto the command line (again, since I'm using the "default web site"). It came back with 2 lines in response:

Successfully migrated section "system.web/httpHandlers".
Successfully migrated section "system.web/httpHandlers".

I then re-requested my CFM page, and it worked, so that seems the solution.

Since I knew I didn't have any custom-written .NET 2.0 apps on my machine, I knew there was no great risk to me doing this. (I had not myself built any .NET 2.0 apps of my own, but I may well have downloaded and installed some app that's built on it. So it's possible that if you have not, that you will not ever get this issue. I'm offering it for those who may, so they can find it on a web search.) (See my update at the top of this entry.)

The blog entry also implies that this may be an issue for SP1, so perhaps others who are not yet on SP1 won't have seen this problem yet. If anyone reads this who is not on SP1 and it solves things for you, do let us know in the comments. (Bill Staples also confirmed that this was not an issue new to SP1.)

Hope this has been helpful for someone.

PS Please, I'm not interested in any snide comments about the wisdom/folly of using Vista. Like others, I have my reasons for doing so, and I've been very satisfied with it so far. I share the above for others in the Vista boat, whether by their choice or others'.

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
Charlie, nice solution. I notice that the command you're using to upgrade the .NET 2.0 app config entries to work properly in integrated mode refers to the default web site, so I presume that all new web site instances you create in IIS will also work properly, since they copy their configuration from the default (right?). But what about other web instances that you've already created-- would you need to run the upgrade command for each one of them?
FWIW, Vista Home Premium also allows multiple sites on IIS.
Thanks, guys.

@Tom, yeah, that's why I clarified that I have only the "default web site" defined. The command line was indeed just for that. I'm afraid I just don't know for sure how new sites would go--well, I didn't as I started to answer this. I decided to go ahead and try it for you.

One thing I'll note is that the setting of the mode is in the pool, not the site, while the conflicting config entries are indeed set for the site. So you need to be aware of the combination of the two to understand the implications being discussed.

(Also, besides the "default web site", there are also settings for "web site defaults", which you see when you select the "Sites" entry in the IIS Manager (top of all sites). Curiously, you don't see the option by right-clicking on it, though. You left click it and it appears in the "actions" on the right side of the screen.)

So I just added a site, and it defaulted to using creating a new pool (of the same name as the web site). You might think it inherited from the defaultapppool, but right-clicking on any of the pools will show an option "set application pool defaults".

As for the config settings (and this conflict), all I can report is that the site worked immediately, so it seems that the conflicting settings are not enabled in new web sites. I suppose it's possible that if someone installed some .NET 2.0 app and implemented it within an existing site, this problem could crop up again.

@Todd, thanks for that. I actually meant to go check on just what editions supported multiple sites, as I wrote that, but I forgot to do so. Good to know it's in Home Premium, too. A lot of CFers using IIS haven't enjoyed the benefits (and challenges) of running multiple web sites, since XP didn't support them. (Yes, Apache fans, they could always install that. And I've written previously on some of the other options to "enable" multiple web sites even on XP. This is from 2005 when I still worked for New Atlanta: http://bluedragon.bl...)
Doh! I just realized, Tom, that you were asking about existing sites, not new ones. I'm afraid I just can't help with that one, since I had no other existing sites when I connected CF to IIS. Maybe someone else can help who will see this in the future, and tries to apply the solution when they *do* have other web sites. :-)
@ Todd

Yup., it does.
# Posted By Kevin Sargent | 3/27/08 11:51 AM
@Kevin, can you clarify: were you confirming what Todd had said about Home Premium supporting multiple IIS sites? Since he wasn't asking a question, it's just not clear what you were getting it so I thought it best to ask.
I've just updated the blog entry above. Turns out that the problem was not that I'd installed .NET 2.0 apps since installing Vista, but rather that I'd restored some files from backup of my pre-vista machine that DID have .NET 2.0 entries in the web config of the wwwroot. As I note in the update, this doesn't diminish the value of the entry. It could still happen to someone that DOES install any .NET 2.0 apps on a Vista machine.

I also explain that I posed this problem to Bill Staples of Microsoft (Principle Product Unit Manager for the IIS Product Division), during which talk I realized that the web.config had come from my restore.

Anyway, he also confirmed that this is *not* an SP1 issue (but would affect the original edition) and also that *all* editions of Vista provide support for multiple web sites. I've asked him to provide any sort of reference that might confirm this if some would want that.
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