iisconfigurationiis-7appcmd

Associate an application pool to site with appcmd


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

Solution

  • 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"