Associate an application pool to site with appcmd

19,969

Solution 1

You can do this:

APPCMD.exe set app "prova/" /applicationPool:"YOUR_APP_POOL_NAME_HERE"

Note the trailing slash appended to prova, that's important.

For example if I wish to set the application pool for prova to the DefaultAppPool I would issue the following command:

APPCMD.exe set app "prova/" /applicationPool:"DefaultAppPool"

Picking up from Chris's comment below, if you have an existing application in your site, say /mybloggy and you wish to change application pool it belongs to then you'd issue the following:

APPCMD.exe set app "prova/mybloggy" /applicationPool:"DefaultAppPool"

Solution 2

Alternative syntax:

APPCMD.exe set site /site.name:"Site name" /[path='/'].applicationPool:"App Pool Name"

Found in Windows Server docs: https://technet.microsoft.com/en-us/library/cc732992(v=ws.10).aspx

Share:
19,969

Related videos on Youtube

JAEP
Author by

JAEP

Ingegnere Informatico

Updated on July 25, 2020

Comments

  • JAEP
    JAEP almost 4 years

    I want create a site by command line using appcmd.

    How can I associate a specific application pool to site?

    To create a site, I write in this way:

    appcmd add site /name:"prova" bindings:http://localhost:8080 /physicalPath:c:\sites\prova
    
    • Abdul Rahman Kayali
      Abdul Rahman Kayali almost 4 years
      Command need one more forward slash before bindings like this appcmd add site /name:"prova" /bindings:http://localhost:8080 /physicalPath:c:\sites\prova
  • Kiquenet
    Kiquenet over 6 years
    I have apps under Default Web Site
  • Chris
    Chris about 6 years
    The syntax for the app name is set app "<site name>/<app name>". This answer threw me off when I was trying to set the app pool for an application in my site.
  • Kev
    Kev about 6 years
    @Chris - yes that would be the case where you already have an application under the site root, say /mybloggy. The example given sets the site root (/) application's app pool. I've updated my answer to make this clearer.
  • Prakash
    Prakash over 4 years
    Can you help to understand How to start the apps under default web site ?? I am able to start the default website in some cases I need to start the web application under the site manually so need to automate that using appcmd.exeto start the same.
  • Majedur
    Majedur over 2 years
    Good job done by @Kev!
  • Kev
    Kev over 2 years
    @Majedur thank you!