get fault information from a webinvoke method using WebClient
I am using new WebClient(url).UploadString(... to invoke a WCF WebInvoke web method. The method is throwing a fault exception.
Is there any way to get more detail开发者_JS百科ed error information other than "The remote server returned an error: (400) Bad Request"
I am throwing a fault (FaultException) with all the relevant information in it.
Regards Craig.
try {
string result = client.UploadString(
"http://localhost:8080/method",
"POST",
xml.ToString()
);
result.Dump();
} catch (WebException ex) {
XNamespace exn = "http://www.w3.org/1999/xhtml";
var error = from node in XElement.Load(ex.Response.GetResponseStream()).Descendants(exn + "p")
select node.Value;
error.Dump();
}
精彩评论