Use a custom app_offline.htm file in IIS Web App Deploy task (TakeAppOfflineFlag: True)

Thomas Nørgaard 1 Reputation point
2021-07-14T12:37:23.3+00:00

Hi guys :)

I have my own app_offline.htm file in the repo. How do I get the CI-pipeline task to use this?

Thanks.

Best regards
Thomas

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 19,491 Reputation points Moderator
    2021-07-15T19:30:26.64+00:00

    Hi @Thomas Nørgaard ,

    Thanks for using Microsoft Q&A. I believe your scenario can be achieved using MS deploy but comes with some limitations as stated below:

    • App offline file should exist in the destination server and need to provide relative path.
    • Destination provider types are limited (we set dest:auto for MSBuild package, which doesn't support custom app offline feature).

    115171-azure-web-deploy.png

    You can also upload the custom app_offline, deploy the package and then remove the uploaded custom file after deployment following these steps:

    To deploy an App_offline file to a destination IIS website, you need to invoke MSDeploy.exe using the Web Deploy contentPath provider. The contentPath provider supports both physical directory paths and IIS website or application paths, which makes it the ideal choice for synchronizing a file between a Visual Studio project folder and an IIS web application. To deploy the file, your MSDeploy command should resemble this:

    msdeploy.exe –verb:sync  
                 -source:contentPath="[Project folder]\App_offline.template.htm"  
                 -dest:contentPath="[IIS application path]/App_offline.htm",  
                  computerName="[Destination web server]"  
    

    To remove the file from the destination site at the end of the deployment process, your MSDeploy command should resemble this:

    msdeploy.exe –verb:delete  
                 -dest:contentPath="[IIS application path]/App_offline.htm",  
                  computerName="[Destination web server]"  
    

    Hope that helps!

    Best,
    Grace

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.