I’m setting a custom StatusDescription in a RESTful WCF service when an exception is thrown. It’s meant to provide the caller with a friendly description of why they got the failure status code.
The following is the response I see in Fiddler. So I know that my custom message is getting pushed back through to the caller. What I can’t figure out is how to retrieve that message from .NET. The StatusDescription does not contain this string.
If you could provide a simple bit of sample code that would be great.
HTTP/1.1 500 Message: “Exception of type ‘Exceptions.DataSourceNotFoundException’ was thrown.” Uri: http://www.test1.com/
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
Date: Mon, 20 Apr 2009 07:13:40 GMT
UPDATE
The answer to this question does not work in Silverlight. Tested in Silverlight 2 and 3 beta.
Not a .NET programmer, Found this on msdn