2012-01-23 46 views
0

如何隐藏以下错误信息并在WCF中显示自定义消息?当我们注入无效参数在HTTP请求如何处理HTTP响应中的WCF SOAP反序列化错误?

HTTP/1.0 500 Internal Server Error 
Cache-Control: private 
Content-Length: 494 
Content-Type: text/xml; charset=utf-8 
Date: Mon, 23 Jan 2012 22:34:36 GMT 
X-Cache: MISS from test.int.testgroup.com 
Via: 1.0 test.int.testgroup.com:80 (squid/2.6.STABLE22) 
Proxy-Connection: close 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode><faultstring xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'GetData'. Character reference not valid. Line 1, position 121.</faultstring></s:Fault></s:Body></s:Envelope> 

回答