Corrupt App Server Host Config File

Applies To:
Windows Server 2008 R2
Windows Server 2012
Windows Server 2012 R2

Recently received a SCOM alert that IIS was not running.

Logged onto the server to manually start and received the following error:
Error –The Windows Process Activation Service encountered an error trying to read configuration data from file ‘\\?\C:\Windows\system32\inetsrv\config\ApplicationHost.config’, line number ’1′.
The error message is: ‘Configuration file is not well-formed XML’

This error is commonly associated with a corrupt ApplicationHost.config file.

Solution:

I copied a known working ApplicationHost.config file from another Application Server. The file can be found at: C:\Windows\System32\inetsrv\config\

Restart the World Wide Web Publisher.

Received another error:
Encountered a Bad Data. (Exception from HRESULT: 0x80090005).

This is due to the encryption and decryption of the properties that are in the file not matching up. So we will need to import the containers so that the web server can encrypt and decrypt these properties.

Run the following commands in CMD prompt on the IIS server that has the good copy of the file:

CD C:\WINDOWS\Microsoft.NET\Framework\<v####>
Where <v###> equals the latest version of .NET framework running on the server.

Aspnet_regiis –px “IISconfigurationKey” “D:\iisConfigurationKey.xml” –pri

Aspnet_regiis –px “IISWasKey” “D:\ IISWasKey.xml” –pri

Copy the iisConfigurationKey.xml and IISWasKey.xml from the location on the good server to D:\ on the new server.

On the server with new config, run the following in a command prompt:

CD C:\WINDOWS\Microsoft.NET\Framework\<v####>
Where <v###> equals the latest version of .NET framework running on the server.

Aspnet_regiis –pi “IISconfigurationKey” “D:\iisConfigurationKey.xml”

Aspnet_regiis –pi “IISWasKey” “D:\ IISWasKey.xml”

And then start IIS.