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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With