Best practices for using app_offline with webdeploy

1.4k Views Asked by At

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

1

There are 1 best solutions below

1
On

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