Application Pool not set when deploying msdeploy iisApp package

msdeployweb-deployment

I'm having an issue with msdeploy not syncing application pool information for a sub application of a site (Default Web Site for example).

Essentially I was hoping I could create webdeploy/msdeploy packages as part of a nightly build process of multiple development branches and then deploy these branch-specific packages to a server for smoke testing. All seems plausible but unfortunately I cannot find a way to set the app pool that the deployed package's iisApp is intended to use. I can create and deploy packages that contain appPoolConfig providers to support the creation of the app pool itself but this is useless if I cannot set the app pool on the application I'm deploying.

By the way, I feel like I'm almost reiterating other questions that appear to be similar. Various answers are given for using appPoolconfig or appPoolExtension but I've had no luck with these. From my reading appPoolConfig is used to sync app pools themselves not the app pool "assigned" to an application. Incidentally, this type of sync operation works well. And as for appPoolExtension I'm at a loss as to what it actually does when it is switched on as I see no difference in the generated package.

I can recreate the problem using a simple set of steps that uses msdeploy only with no WPP/webdeploy/msbuild in the way with the intention that it should work with the lowest level tool alone:

Windows 8 (note: I can replicate the issue on Win 2008 R2 also), IIS and Web Deploy 3.0 installed.

  1. Assuming a Default Web Site exists and .NET 4.0 is installed, create a new application pool called TestPool.
  2. Create a new application called TestApp under Default Web Site and assign its application pool to the TestPool created in step 1.
  3. Open command prompt with path access to msdeploy.
  4. Type >

    msdeploy -verb:sync -source:iisApp="Default Web Site/TestApp" -dest:package=c:\temp\testapp.zip,encryptPassword="password" -enableLink:AppPoolExtension
    
  5. Now that we have a package we can delete TestApp from under the Default Web Site and delete any remaining physical folder created as part of the initiall application creation.
  6. Assuming we still have the TestPool application pool configured in IIS as an available pool, type >

    msdeploy -verb:sync -source:c:\temp\testapp.zip,encryptPassword="password" -dest:iisApp="Default Web Site/TestApp" -enableLink:AppPoolExtension
    
  7. Go to IIS Manager and select our TestApp under Default Web Site. Click Basic Settings… and the Application Pool is not the required TestPool but instead is the default pool set for the Default Web Site.

Any help is appreciated.

EDIT:
Just ran a variation on the steps above and change the "iisApp" to "appHostConfig" in both msdeploy command lines and the app pool settings are retained so a success from an msdeploy point of view. However, if this is the solution, how does one inform the VS 2012 publish process to use appHostConfig rather than issApp?

EDIT:
In answer to my own edit this answer worked: https://stackoverflow.com/a/12741525/739097. This begs another question though about how one can integrate the package creation on a build server with no IIS but my thoughts here are that one would create a template package first based upon the required IIS settings, dynamic parameters, etc but essentially empty of content. The build process would then create a package of content only and sync this with the template package to create a final package for deployment.

Best Answer

Your question has become multi-faceted through your edits, but I'll tackle one thing at a time.

Only the appHostConfig provider can create global IIS objects like sites and application pools.

iisApp is simply a composite of createApp (can mark directories as an application) and contentPath (syncronises files/folders).

In order to package/sync an appHostConfig provider rather than an iisApp provider, you need to do two things:

  1. Have your project file marked as using IIS with a valid URL (you can override the MSBuild file to examine for these properties by defining WebPublishPipelineWAPProjectSettings)
  2. Declare a IncludeIisSettings=true in your publish profile

But, yes, this requires IIS to be installed on the build server (or, at least, for the build server to have access to the IIS instance). MSDeploy is, after all, a web synchronisation framework.

What you could potentially do is to have a package, generated manually, that contains your website definition and another, generated during build, that contains the content. Careful with this, though, as you might run into errors if the app pool contains advanced options and the package was not generated by the same version of IIS as the deployment target.

Related Topic