sakraycore
sakraycore

Reputation: 13

How do you put IIS web services into maintenance mode?

How do you put web services into maintenance mode?

I've tried the app_offline.htm, doesn't seem to work well for web services. Does work for web site though.

app_offline.htm worked fine for web sites, but not for web service. When I called an web service function via code that's supposedly under maintenance (put the app_offline.htm under the root directory of the IIS web service), I still got the proper response as usual.

Ideally I would like the web service that's under maintenance to return to me a message like "under maintenance".

Upvotes: 1

Views: 3082

Answers (2)

McGarnagle
McGarnagle

Reputation: 102753

Create a utility function for your web services, which checks for the presence of app_offline.htm at your website's root path, and responds accordingly.

Note that if you wanted to get fancy with it, you could use a part of the WCF pipeline (assuming you're using WCF and not the legacy .ASMX services) to modify your services/methods by using an attribute (eg, this method).

Upvotes: 0

Colin Pickard
Colin Pickard

Reputation: 46643

You can edit your Global.asax as suggested by this answer to another question. Then trigger it by setting a flag when you are in maintenance mode

In my opinion, when a service is unavailable, you should respond with a 503 Service Unavailable status; but you can do anything you like with the response.

Upvotes: 1

Related Questions