RESTful Service HttpException Provider

This was really interesting. Although I was trying to enforce HTTP errors as described in the previous post, I couldn't do in in a RESTful WCF service. Everytime, I set the header to send errors 401 or 403, the client was still receiving Error 500. In the end I had to do something a bit more clever: implement IErrorHandler

I don't really want to go into details explaining how IErrorHandler works in this article. There are plenty of other articles that will do it better than I can. The key point is that: in order to return a HTTP Error (like 401) we need to use fault provider like so:

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box