Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Application Pool for package using MSDeploy

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.

like image 449
bearrito Avatar asked Oct 26 '10 12:10

bearrito


2 Answers

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.

like image 115
askheaves Avatar answered Nov 04 '22 21:11

askheaves


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.

like image 1
csm8118 Avatar answered Nov 04 '22 21:11

csm8118