13

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.

SteveC
  • 15,808
  • 23
  • 102
  • 173
bearrito
  • 2,217
  • 1
  • 25
  • 36

2 Answers2

19

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.

SteveC
  • 15,808
  • 23
  • 102
  • 173
askheaves
  • 745
  • 1
  • 5
  • 9
  • 7
    blowed if I can get this to work. Scripting out the app pool just fine, but setting that parameter when I call msdeploy seems to make no difference. – piers7 Sep 11 '12 at 00:33
  • I seem to get the following error when I try this: `Error: Source (sitemanifest) and destination (appHostConfig) are not compatible for the given operation.` – Andy Joiner Jun 28 '19 at 22:32
  • I get this `Error: Using a 64-bit source and a 32-bit destination with provider appHostConfig is not supported.` – Daniel Leach Feb 09 '21 at 19:06
1

Take a look at this answer:

Set application pool with MSDeploy and TFS 2010

Basically, you create a batch file with an adsutil script to set the app pool, and then you call MSDeploy to run that batch file on the target computer.

Community
  • 1
  • 1
csm8118
  • 1,213
  • 9
  • 11