Set Application Pool for package using MSDeploy

bearrito picture bearrito · Oct 26, 2010 · Viewed 17k times · Source

I am deploying a website using MSDeploy so using something like the below code.

"%ProgramFiles%\IIS\Microsoft Web Deploy\msdeploy.exe" 
     -verb:sync
     -source:package=WebAppServer.zip 
     -dest:Auto 
     -setParamFile="was_params.xml" 
     -verbose 
          >  webappserversync.log

Is there anyway to set the application pool ? I want to do this from the command line and not set it in a manifest or anything like that.

Shouldn't matter but this is in IIS7.

Answer

askheaves picture askheaves · Nov 12, 2010

When you generate your package, you need to have an entry in the parameters.xml file for setting the Application Pool. When deploying, you either include a value for that in your setParameters.xml file, or use -setParam from the command line.

Here is the command I used to grab a site, which generated the proper parameters.xml file ...

msdeploy.exe 
  -verb:sync -source:appHostConfig="Default Web Site" 
  -enableLink:AppPoolExtension 
  -dest:package=site.zip 
  -declareParam:name="Application Pool",
       defaultValue="Default Web Site",
       description="Application pool for this site",
       kind=DeploymentObjectAttribute,
       scope=appHostConfig,
       match="application/@applicationPool"

And to install this site from the command line, this ...

msdeploy.exe 
    -verb:sync 
    -dest:appHostConfig="MagicSite" 
    -enableLink:AppPoolExtension 
    -source:package=site.zip 
    -setParam:"Application Pool"="MagicPool"

Dig around in the parameters.xml file to see the entry necessary. And if you prefer, that -setParam entry can exist in your params.xml file instead.