Value that I set on server side for WebOperationContext.Current.OutgoingResponse.StatusDescription property is ignored. Client side gets a default message, for example Not Found for 404 code, OK for 200.
I also had this same problem. I can return the body of the response but everything else, status code, headers, etc. is overridden somewhere down the line.
To get around this you can throw a WebFaultException which lets you set the status code.
throw new WebFaultException<string>("Tell the calling client what went wrong", System.Net.HttpStatusCode.Conflict);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With