user2598794
user2598794

Reputation: 727

Cannot set application pool for site in IIS via appcmd

I'm trying to set the application pool for a site via appcmd.

  1. I add a pool:

    appcmd add apppool /name:"TestAppPool" /managedPipelineMode:Classic
    
  2. I add a site:

    appcmd add site /name:"MyTestSite" /physicalPath:C:\MyTestSite
    
  3. Then I set a pool for this site:

    appcmd set site /site.name:"MyTestSite" /[path='C:\MyTestSite'].applicationPool:TestAppPool
    

    Here I get an error:

    ERROR ( message:Cannot find requested collection element. )

What's wrong here?

Upvotes: 1

Views: 5498

Answers (1)

user2598794
user2598794

Reputation: 727

Got it working with this:

appcmd add site /name:"MyTestSite" /bindings:"http/*:81:" /physicalPath:c:\MyTestSite

appcmd set site /site.name:"MyTestSite" /[path='/'].applicationPool:TestAppPool

Upvotes: 3

Related Questions