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.
Best Answer
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 theExample Pool
using theStop-WebAppPool
andStart-WebAppPool
. There is also aRestart-WebAppPool
module you could run instead.