Display a nice maintenance page for public visitors during deploy in IIS

app_offline is a nice and efficient solution for taking an IIS website offline and displaying a message during deploy. However it has some drawbacks, you cannot visit the site yourself, and if you’re making a larger deploy and need to access the site without having visitors around this method won’t work.

I found a really nice and really simple solution for doing this in IIS:

1. Create a HTML page with the message you want to display during the downtime. Place it in the web root.

2. Edit feature settings for IP restrictions. Set deny access for unspecified clients, and add your own IP as an allow entry.

IIS restrictions

Now only you can access the site. But the other users will get an ugly 403 page.

3. Edit the error pages for the site, enter your html page for the 403 error.

IIS 403

Done! You will reach the site and all other users will get a nice maintenance message.

Remember to restore the original value for the 403 error when you’re done.