I was helping out a customer a few weeks ago to use the Web Deployment Tool to migrate applications and sites from IIS 6.0 to IIS 7.x/8.x, and ran into an error I had not seen before. I thought I'd document it here in case I, or anyone else, runs into it again.

During our work, we exported an entire IIS 8.5 server to a ZIP package using the Web Deployment Tool tasks integrated into the IIS Management Console (inetmgr).

When we tried to restore the server archive on the same server, we got the following error:

Error: Invalid application pool name

After investigating the issue for a while, I realized the problem was that the IIS configuration of the server was invalid before we exported the server package! IIS is very robust at dealing with some invalid configurations, and this was such a case: The server appeared to work perfectly fine even though there was one slight configuration error, that would have only caused trouble under very specific circumstances!

To figure it out I had to attempt the restore operation using the command line msdeploy.exe tool rather than the UI. Capturing the full log, I noticed that the last relevant entry was:

Info: Updating applicationDefaults (MSDeploy.webServer/webServer/appHostConfig[@path='']/location[@path='']/section[@name='system.applicationHost/sites']/sites/site[@name='Default Web Site']/applicationDefaults).

The problem turned out to be that for some reason, the applicationPool attribute of the section for all sites was not set. When the full server archive was created, Web Deploy exported a blank value for this property. When I looked at the archive.xml included in the ZIP file, this could be seen clearly:

<applicationDefaults
path='' MSDeploy.path='1'
applicationPool=''
MSDeploy.applicationPool='1'
enabledProtocols='http'
MSDeploy.enabledProtocols='1'
serviceAutoStartEnabled='false'
MSDeploy.serviceAutoStartEnabled='1'
serviceAutoStartProvider=''
MSDeploy.serviceAutoStartProvider='1'
preloadEnabled='false'
MSDeploy.preloadEnabled='1'
MSDeploy.MSDeployLinkName='applicationDefaults' />

How to fix it

Once I had this nailed down, working around it was easy: I simply extracted the entire ZIP archive to a folder, modified the archive.xml file to set a applicationPool='DefaultAppPool', and then simply imported the server backup directly from the extracted folder by using the archiveDir provider as the source. Alternatively, I could've created the ZIP file again and import it as usual.


Tomas Restrepo

Software developer located in Colombia.