Fixing Application Pool not starting problem by editing ApplicationHost.config

While playing around with Windows Server AppFabric I created a new Application pool set for .NET 4. However this application pool would immediately throw an error when starting;

“The worker process failed to pre-load .Net Runtime version v4.0.21006.”

A little experimentation showed that changing to the built in application pool worked. So it looks like IIS, when creating a new application pool, configures for the wrong .NET version.

I then found that this kind of information is stored in ApplicationHost.config, but I couldn’t find it anywhere on my system (except backups in history). Hmmm. And I wasn’t the only one.

So using notepad (!) I could open this file in “C:\Windows\System32\inetsrv\config”. Best of course is to first stop IIS and make a backup of the file.

Then I edited the <applicationPools> section, looking for v4.0 and replacing it with v4.0.30128.

And yes! That fixed it.