Best practices for using app_offline with webdeploy
Asked Answered
P

1

8

When I deploy my web site I need to:

  • Take the site offline.

  • run sql to update the database.

  • update the web site.

  • Put the site back online

I would like to script as much of this as possible without have to go the server and make manual changes.

I am currently using WebDeploy to push my website changes. It works great, and I don't have to know exactly where my site is installed on the server.

So what is the best way to put up/take down the app_offline file? If have seen some solutions where you rename an existing file ( app_offline.htm_ ) using an msbuild script. But it seems like that would require me to know the location of this file.

Is there a way to do this through web_deploy?

Thanks

Pestalozzi answered 24/10, 2011 at 21:29 Comment(1)
I found this article helpful: asp.net/web-forms/tutorials/deployment/…Hunkydory
V
2

Yes, you can enable AppOffline during a WebDeploy deployment you can even customize the AppOffline template:

msdeploy.exe -verb:sync -source:iisApp=sourceApp -dest:iisApp=destApp,appOfflineTemplate="offlineTemplate.htm" -enablerule:AppOffline

https://blogs.iis.net/msdeploy/webdeploy-3-5-rtw

Vomit answered 29/12, 2016 at 4:15 Comment(1)
Keep in mind that the path specified in appOfflineTemplate is a path relative to the IIS website folder, and the file should already exist there.Roseline

© 2022 - 2024 — McMap. All rights reserved.