2016-02-11 40 views
0

當我嘗試登錄到WCF,我得到的錯誤信息: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. 

我試圖解決它作爲recomended as answer to similar question

通過更換:

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

有:

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

,但我得到一個錯誤:

the "envelopeVersion"attribute is not allowed 

感謝。

+0

開關,或者使用自定義綁定。 – Tim

回答

0

basicHttpBinding是SOAP 1.1。 documentation指出,對於envelopeVersion的此綁定,唯一有效值是「Soap11」。

wsHttpBinding是SOAP 1.2。嘗試使用代替的basicHttpBinding:從`basicHttpBinding`(這是SOAP 1.1)至`wsHttpBinding`(這是SOAP 1.2)

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