question

ThomasNrgaard-9386 avatar image
0 Votes"
ThomasNrgaard-9386 asked Grmacjon-MSFT answered

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

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-webapps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Grmacjon-MSFT avatar image
0 Votes"
Grmacjon-MSFT answered

Hi @ThomasNrgaard-9386 ,

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


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.