I’m hosting some SOAP services with WCF. How can I turn off these services via config for the purposes of maintenance, etc., and provide a friendly message to the service consumer with something like “The service you’ve requested is down for maintenance.”?
Share
How about this: create a custom ServiceBehavior to intercept my incoming requests to the service. Then, have the custom behavior check a user-defined flag in my config file, something like
<add key="IsMyServiceUp" value="true" />and if that value returns asfalsethen throw a ServiceException with my friendly message and HTTP code of 503 – Service Unavailable.Does that sound reasonable? Then all I have to do is change the flag in my config file to specify where the service is up or down.