Twitter Image

Settings Dynamics CRM in Maintenance Mode

Written by Stéphane Dorrekens
Thursday, 03 May 2012 10:08

I had an issue some time ago where a major implementation went haywire (I won't go in too much details, but let's say that when the database cluster start doing ping-pong failover together with the SAN you are in trouble)
While the IT Ops teams were busy trying recovering the cluster, I got a query from the support team who asked if we could put a temporary 'Ouf of Order - Maintenance' web page on the CRM web site so that users could stop hammering the first line support.

As the applications servers were still up and running it seemed to be just a matter to redirect the default MSCRM page to a new page.
The fastest way I knew to do this in asp.net is to create a file called app_offline.htm (containing your Maintenance message) at the root of the web site and all calls will be directed to that web page; unfortunately when trying this method I got a 404 message.
I was a bit puzzled and was thinking an HTTP module was involved but I quickly found the explanation in this blog post.
I didn't want to go the HTTP Module way or changing anything to the existing MSCRM web site files as I wanted to be able to reverse the solution as fast as possible and be sure of the system stability afterwards.
After a quick thought, I decided to create a new clean web site called Offline with a single default page in it on the default port, then changed the Dynamics CRM web site port to another port.
There's some advantages to this solution :

- You can just stop site, change port with IIS manager; so no need to have console access to the application servers
- The CRM Web site is still accessible (on the new port), so you can test that everything is ok before reverting to normal operations
- the 'Offline' web site can be defined beforehand just for this kind of thing.
- If a planified maintenance needs that no user interactions/access is enforced, is quite easy to achieve.

Here's how the configuration now looks like in IIS