Clift Norris
Clift Norris

Reputation: 649

How can I indicate to users that my IIS website is undergoing maintenance?

For my IIS website, I'd like to redirect ALL requests to ONE page. The purpose of this is that I want to do some maintenance on the database (take it off-line) that all my web applications use. I have about 50 web apps running under this website, so I'd like to avoid visiting each of them to change something. I'm thinking I could make a single change in machine.config? Any hints would be appreciated.

Upvotes: 64

Views: 74867

Answers (5)

StuartN
StuartN

Reputation: 357

In IIS 10 there is an optional component "HTTP Redirect" (it may be available in earlier IIS versions; I don't know). It allows you to set up very simple catch-all redirects, using any of the common HTTP redirect response codes. This can be installed via Server Manager, in Windows Server 2019.

Upvotes: 3

LordHits
LordHits

Reputation: 5073

If you are using ASP.NET 2.0 (or higher), you can drop an app_offline.htm page on the root.

More info here.

Upvotes: 100

Lazlow
Lazlow

Reputation: 3351

Could you create a new site in IIS with a binding to port 80 with a blank host-header (much like the Default site) and then stop the other site(s)? That way all requests would be handled by the new site, which could simply be a static HTML page notifying users that the site is down for maintenance.

Upvotes: 1

se_pavel
se_pavel

Reputation: 2208

in webconfig

 <rewrite>
        <rules>
            <rule name="redirect all requests" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
                </conditions>
                <action type="Rewrite" url="index.php" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>

Upvotes: 57

pipTheGeek
pipTheGeek

Reputation: 2713

Make all the pages un-available, probably stop the current web site and create an entire new completly blank site in its place. Then put up a custom error page for the 404 (file ot found) error. Custom Errors is a tab on the properties dialog of the web site in IIS. Just create the page you want to send, then change the entry for 404 on the custom errors tab to point to the new file you just created.

Upvotes: 11

Related Questions