Psconfig Wizard Fails : Bad Data. (Exception from HRESULT: 0x80090005)

While adding a new server to the farm, PSConfig Wizard fails on step 3 with following error

An exception of type System.Runtime.InteropServices.COMException was thrown. Additional exception information: Bad Data. (Exception from HRESULT: 0x80090005)

Error from the PSCDiagnostics log:

03/16/2011 11:01:39 11 ERR Task configdb has failed

03/16/2010 11:01:39 11 INF friendlyMessage for task configdb is An exception of type System.Runtime.InteropServices.COMException was thrown. Additional exception information: Bad Data. (Exception from HRESULT: 0x80090005)

03/16/2010 11:01:39 11 INF debugMessage for task configdb is An exception of type System.Runtime.InteropServices.COMException was thrown. Additional exception information: Bad Data. (Exception from HRESULT: 0x80090005)

--------------------

This is caused due to moving the Applicationhost.config file from one server to another.

In order to prove that this was IIS 7.0 issues, perform the following step on the server where the SharePoint Products and Technologies Configuration wizard (PSConfig) is failing.

Create New Default Web Site and then attempted to browse it

Note: Ensure that we are using the default application pool.

Result. Works fine.

Now let’s change the identity to a domain account and then attempt to browse the site

Result. BAD Data exception

When you set the application pool identity to a domain account IIS has to keep a local copy of the username and password. Hence, it stores a copy in its applicationHost.config and as it is not advisable to keep the password in clear text format it goes ahead an encrypts it.

For the encryption it uses machine specific keys in the iisConfiguration and iisWasKey containers. When the applicationHost.config is moved to a different server IIS can no longer decrypt the settings.

Solution:

To get this working you can export and import the keys from the original server using following commands

Execute following commands to export the files.

aspnet_regiis -px "iisConfigurationKey" "C:\iisConfigurationKey.xml" -pri

aspnet_regiis -px "iisWasKey" "C:\iisWasKey.xml" -pri

Copy these files iisConfigurationKey.xml and iisWasKey.xml from C: on the source server to the C: on the destination server.

Execute following commands to import the files.

aspnet_regiis -pi "iisConfigurationKey" "C:\iisConfigurationKey.xml"

aspnet_regiis -pi "iisWasKey" "C:\iisWasKey.xml"

Now re-run the PSConfig Wizard and it will complete successfully.