WCF - 服务引用登录失败,因为肥皂版本

本文关键字:因为 肥皂 版本 失败 登录 服务 引用 WCF | 更新日期: 2023-09-27 18:34:09

当我尝试登录到WCF时,我收到错误消息:

An exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll but was not handled in user code
Additional information: The envelope version of the incoming message (Soap12 (http://www.w3.org/2003/05/soap-envelope))
does not match that of the encoder (Soap11 (http://schemas.xmlsoap.org/soap/envelope/)).
Make sure the binding is configured with the same version as the expected messages.

我试图按照建议解决它作为类似问题的答案

通过替换:

<basicHttpBinding>
    <binding name="LoginServiceSoap" />
</basicHttpBinding>

跟:

<basicHttpBinding>
   <binding name="LoginServiceSoap"
         envelopeVersion="Soap12" />
</basicHttpBinding> 

但是我收到一个错误:

the "envelopeVersion"attribute is not allowed

谢谢。

WCF - 服务引用登录失败,因为肥皂版本

basicHttpBinding是SOAP 1.1。 文档指出,对于envelopeVersion的此绑定,唯一有效的值是"Soap11"。

wsHttpBinding是 SOAP 1.2。 尝试使用它而不是basicHttpBinding

<wsHttpBinding>
  <binding name="LoginServiceSoap" />
</wsHttpBinding>