mburm
mburm

Reputation: 1493

Set Application Pool in IIS Deployment with Azure Release Pipeline

I'm deploying an IIS Web App with IIS Web App Deploy Task in Azure DevOps Release Pipeline. This works good but don't set the correct application pool. I'm trying it with set a Parameter in Parameters.xml or as -setParam to the Task. But this doesn't change anything. The googled Solutions didn't help. How can I manipulate the Application Pool during deployment? Thanks.

EDIT

In reference to this answer I configured the parameters.xml and pipeline like this. (appHostConfig instead of appPoolConfig hadn't changed anything)

parameters.xml

<parameters>
    <parameter name="Parameter 1" description="Full site path where you want to install your application (for example, Default Web Site/Application)." defaultValue="Default Web Site/MyApplication" tags="IisApp">
        <parameterEntry kind="ProviderPath" scope="iisApp" match="Default\ Web\ Site/MyApplication" />
    </parameter>
    <parameter name="Parameter 2" description="Enter the name of the application pool." defaultValue="MyAppPool" tags="AppPoolConfig">
        <parameterEntry kind="ProviderPath" scope="appPoolConfig" match="MyAppPool" />
    </parameter>
    <parameter name="IIS Web Application Name" description="Enter the name of the website." defaultValue="MyApplication" tags="IisApp" />
    <parameter name="Application Pool" description="Enter the name of the application pool." defaultValue="MyAppPool" tags="AppPoolConfig" />
</parameters>

Set the website in IIS Web App Deploy Task (results to -setParam:name='IIS Web Application Name',value='Default Web Site/MyApplication')

Website / Application

Set the Application Pool parameter in IIS Web App Deploy Task

Application Name

Upvotes: 1

Views: 5819

Answers (3)

Mike Gledhill
Mike Gledhill

Reputation: 29201

This bug is still present in the Azure Pipelines "IIS web app manage" step, in December 2023.

  • It creates the App Pool.
  • It creates the empty IIS website.
  • But it doesn't link the website to the App Pool (sigh.)

The fix, as described here is to add a line like this to the Advanced\Additional appcmd.exe commands section:

set site /site.name:"$(WebsiteName)" -[path='/'].applicationPool:"$(YourAppPoolName)"

enter image description here

(A day later..)

Today, I noticed that, in the "IIS web app manage" step, if your App Pool already exists, and you specify a new Physical Path for your IIS website..

  • it will create that folder...
  • "IIS web app deploy" will deploy your files to this folder...
  • but the IIS website will not be updated to point at this folder.

Once again, you can use "set site" to fix this. (Sigh.)

set site /site.name:"$(WebsiteName)" 
-[path='/'].applicationPool:"$(YourAppPoolName)" 
-[path='/'].virtualDirectory[path='/'].physicalPath:"D:\SomeFolderOrOther"

Btw, in my "IIS web app deploy" page, I have the Action set to "Create or Update", and under IIS Website, I have "Create or update app pool" ticked.

Upvotes: 0

Crisci
Crisci

Reputation: 1

Create inline PowerShell Script task after Web App Deploy with:

c:\windows\system32\inetsrv\AppCmd.exe set app /app.name:"APPLICATIONNAMEHERE" /applicationpool:"APPLICATIONPOOLNAMEHERE" 

to assign the application pool created above.

Upvotes: 0

Leo Liu
Leo Liu

Reputation: 76910

Set Application Pool in IIS Deployment with Azure Release Pipeline

Since you do not share how did you set the Parameter in Parameters.xmland -setParam to the Task, I am not sure if you correct set the Parameter.

You could check this and this thread for some more info.

Anyway, for azure devops, there is an option Application Pool for the task IIS Web App deployment, which we could set the Application Pool:

enter image description here

Besides, the IIS Web App deployment is currently deprecated, MS recommends the task WinRM - IIS Web App Management.

Update:

There is an option Configuration type, select IIS Website:

enter image description here

Please check this document for some more details.

Hope this helps.

Upvotes: 1

Related Questions