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
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
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"
/mybloggy
. The example given sets the site root (/
) application's app pool. I've updated my answer to make this clearer. –
Moller 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
Although the OP was looking to assign the app pool within the "add site" command, I couldn't find a way to include it with the original "add site" command. I got it working using "add site" followed by "set site" using syntax by Kev above.
On the other hand, if you ever need to add an "application" under that "site", you can specify the app pool when you use the "add app" command with the applicationPool
argument as here:
APPCMD add app /site.name:"prova" /path:/App1 /physicalPath:c:\sites\prova\App1 /applicationPool:"provaAppPool"
p.s. You may need to prefix APPCMD with %systemroot%\system32\inetsrv\
and call
%systemroot%\system32\inetsrv\APPCMD /site.name:"prova"...
© 2022 - 2024 — McMap. All rights reserved.
bindings
like thisappcmd add site /name:"prova" /bindings:http://localhost:8080 /physicalPath:c:\sites\prova
– Coltun