所以我有一个使用 ASMX Web 服务的 WCF 客户端。一切正常,除了异常处理。
在我应该得到(非合同)FaultException 的地方,我得到了 CommunicationException。
可能有什么问题?
相关数据如下:
SOAP 响应(似乎符合规范):
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">User not found or password is incorrect (User not found)</soap:Text></soap:Reason><soap:Node>Login</soap:Node><detail><ErrorInfo xmlns="http://tempuri.org/"><Area>Security</Area><ErrorCode>1</ErrorCode><Message>User not found or password is incorrect (User not found)</Message></ErrorInfo></detail></soap:Fault></soap:Body></soap:Envelope>
ex.Message(CommunicationException):
Server returned an invalid SOAP Fault. Please see InnerException for more details.
ex.InnerException.Message (XmlException) :
End element 'Fault' from namespace 'http://www.w3.org/2003/05/soap-envelope' expected. Found element 'detail' from namespace ''. Line 1, position 444.