WCF Custom Error Page when self-hosting service (Without IIS)

1k views Asked by At

I have a self-hosted WCF service that exposes only one WebInvoked operation with address and parameters as such:

www.myserver.com/myservice/SayHello?LuckeyNumber=3  (where LuckeyNumber : int)

Now, when someone is trying to access this address but with LuckeyNumber=EvilInput I get a WCF error page that I would like to replace with a page (Similar to the Twitter Fail Whale).

  1. How to replace this page?
  2. Can I replace the page also for 404s, 405s and etc?

Thanks!

1

There are 1 answers

1
GeekzSG On

For self-hosted WCF, if you hosting REST services you can add WebHttpBehavior to get a HELP page, but you surely can send Fault Exception details (not the entire html page) in the response of your service.

The application consuming these services should take care of displaying the fault details in a fancy error page.

You should always leave that decision on the consumer (not at service layer) to mask this data and display/log it as they need it.