Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you implement "Site under maintenance" for Windows Azure Web Site?

In one of our ASP.NET Web site solutions I need to roll out an update that might take reasonable time. It spawns multiple Windows Azure Workers and projects and so simple Deployment Swap is ruled out.

Essentially I'm just thinking about way to redirect all web requests to a "site is under maintenance" page for some time, given the project is under Windows Azure.

I'm aware of the app-offline.htm trick with IIS, but I doubt that Azure Web Role will allow this one to be deployed or run (it spins down the app domain).

like image 518
Rinat Abdullin Avatar asked Jul 10 '10 10:07

Rinat Abdullin


People also ask

How do I show maintenance page during deployment?

An idea would be: to create another app on the same web server. create httpmodule or httphandler to handle any url request and 302 redirect them to the maintenance page.


1 Answers

After some additional investigation, it seems that one of the implementation options is to create a separate web project (deployment package and the web role) that redirects all requests to the single maintenance page. Url Rewrite module (installed on Azure by default) could be configured like this:

<rules>
  <rule name="Redirect exclusions" stopProcessing="true">
    <match url="\.(css|gif|png|htm|jpg)$" />
  </rule>
  <rule name="Redirect to index" stopProcessing="true">
    <match url="^(.*)$" />
    <action type="Redirect" url="/index.htm" />
  </rule>
</rules>

Deploying this project via the swap will ensure logical consistency, while the message details (if maintenance period is expected to be longer) could be passed through the cscfg settings.

like image 124
Rinat Abdullin Avatar answered Oct 02 '22 10:10

Rinat Abdullin