Display banner during rollout of web site

Whilst deploying a new version of a website I want visitors to be presented with a banner that says something like “deployment in progress, please come back later”. I thought I could achieve this by switching off my main iis website and switching on a very simple “banner” site whilst the main site is deploying, however if I have my banner website running on port 80 the deploy fails with the following message

start-webitem : Cannot create a file when that file already exists

Is there a better way to do what I want? I would have thought displaying a maintenance banner during deployment is a pretty common requirement.

Many thanks

Hi Chris,

Thanks for getting in touch!

I think you are getting the error Cannot create a file when that file already exists because the bindings of the web sites conflict and they are both trying to run at the same time. You may need to wait for your live website to stop before starting the maintenance website and vice versa when the live site is back up.

Alternatively you could swap your website’s index file with a maintenance file.
There is a step template that you could use if wanted to try this approach:

https://library.octopusdeploy.com/step-template/actiontemplate-iis-change-app-offline

And some information on using step templates here: http://docs.octopusdeploy.com/display/OD/Step+Templates.

I hope this helps, please let me know if there is anything else I can assist with.

Cheers,
Shane

Thank you Shane. I stop my main site before starting the banner site so don’t know why a conflict would occur. I shall try the template you suggest.

Get Outlook for Androidhttps://aka.ms/ghei36


One other thing, I need to ensure that any call to the website will route to the app offline file. E.g mywebsite.com/abc/def will this work.?

Get Outlook for Androidhttps://aka.ms/ghei36


Hi Chris,

If your maintenance page is called app_offline.htm then all requests should be routed to that page.

Cheers,
Shane

Shane,

Thanks for the reply, and perhaps I’m missing something however I’ve placed an app_offline.htm page in the folder that iis points but it is only shown if the user navigates to www.mysite.com. If they visit https://mysite.com/mvc#/Dashboard/ChildFolder then iis attempts to serve up the contents of the child folder.

Hi Chris,

app_offline.htm is an ASP.NET feature, I’m not familiar with all of the nuances so unfortunately I’m not sure why your child folder is serving content. I’ve done some reading https://weblogs.asp.net/scottgu/App_5F00_Offline.htm-and-working-around-the-2200_IE-Friendly-Errors_2200-feature and http://stackoverflow.com/questions/1153449/asp-net-2-0-how-to-use-app-offline-htm

Make sure the app_offline.htm is in the root of your website and ensure that it is at least 512 bytes.

Cheers,
Shane

Thanks for digging Shane, it would appear that app_offline.htm only stops asp.net content, static html is still served and that is my problem. I think I need to look at setting http redirects up via a powershell script.


In the end I had to write a couple of powershell scripts to get this working, firstly one to rename a file to app_offline based on one in the community library and then set up http redirects so that any child directories accessed route the user to app_offline.

Thanks for your guidance