I tried to use this:
return Request.CreateResponse(HttpStatusCode.InternalServerError, \"My message\");
also I tried this one:
I was able to put a custom message in the error response body with the following code:
Response.TrySkipIisCustomErrors = true; Response.Clear(); Response.Write( $"Custom Error Message." ); return new HttpStatusCodeResult( HttpStatusCode.InternalServerError );