1

I am creating GitHub actions to automatically deploy my website.

I have everything working other than the ability to remotely restart the application pool.

From what I've read, I need to stop the application pool, publish the site, start the application pool

shell: cmd
  run: '"C:/Program Files (x86)/IIS/Microsoft Web Deploy V3/msdeploy.exe" -verb:sync -allowUntrusted -source:recycleApp -dest:recycleApp="${{ env.IIS_WEBSITE_NAME }}",recycleMode="StopAppPool",computerName="${{ env.DOMAIN_URL }}:8172/msdeploy.axd?site=${{ env.IIS_WEBSITE_NAME }}",username="${{ env.IIS_SERVER_USERNAME }}",password="${{ env.IIS_SERVER_PASSWORD }}",AuthType="Basic"'

The output from this command is

Info: Using ID '0a153730-a072-4bb1-868e-ae39a3e7659b' for connections to the remote server.
Info: Adding MSDeploy.recycleApp (MSDeploy.recycleApp).
Info: Adding recycleApp (***).
Error: (11/23/2020 7:08:08 AM) An error occurred when the request was processed on the remote computer.
Error: Unable to perform the operation. Please contact your server administrator to check authorization and delegation settings.

I don't know how to work out why this is the case! MSDeploy.exe works fine to deploy the website using the same remote path, username and password.

Do I need to enable remote recycling of application pools on the remote machine? I found the folder where the logs are stored but found nothing useful (although I likely don't know what I am looking for)

I don't know how to make this work. as the output is not telling me what I need to do.

2 Answers 2

1

You should be able to accomplish this using PowerShell. The WebAdministration module has many cmdlets for managing IIS. The snippet below will stop and start the Example Pool using the Stop-WebAppPool and Start-WebAppPool. There is also a Restart-WebAppPool module you could run instead.

shell: powershell
run: Import-Module WebAdministration; Stop-WebAppPool -Name "Example Pool"

...your other deployment steps...

shell: powershell
run Import-Module WebAdministration; Start-WebAppPool -Name "Example Pool"
2
  • Can you confirm that this will work remotely - the reason I ask is you're not actually specifying a remote location, let alone any credentials in the example code you've given :( - docs.microsoft.com/en-us/powershell/module/webadministration/… appears as if it's not possible (although I could have easily missed the information in that massive page)
    – Dave
    Nov 24, 2020 at 11:32
  • 2
    Sorry, I missed the remote aspect. Assuming WinRM is configured in your environment and the user running the command has the necessary access you can wrap the above commands in Invoke-Command -Computername <your server> -ScriptBlock {Import-Module WebAdministration; Stop-WebAppPool -Name "Example Pool"}. Nov 25, 2020 at 14:29
0

Turned out, recreating the permissions on the server was all that was needed.

I may have changed the account from a standard to an administrator, I can't remember what the original type was!!

I also changed the password (although I'm confident that the password was not the cause)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .