我创建了控制台应用程序来使用 Web 服务。当我调用该 Web 服务时,我遇到异常
The envelope version of the incoming message (Soap11 (http://schemas.xmlsoap.org/soap/envelope/)) does not match that of the encoder (Soap12 (http://www.w3.org/2003/05/soap-envelope)). Make sure the binding is configured with the same version as the expected messages.
这是我的配置。你能帮我解决这个问题吗?
<wsHttpBinding>
<binding name="SecurityDemo">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
<endpoint name="endpointname"
address="URL"
binding="wsHttpBinding" bindingConfiguration="SecurityDemo"
contract="contractname" />
最佳答案
通过采用 wsHttpBinding,您基本上是在强制您的客户使用 Soap12。将其更改为 BasicHttpBinding 并查看是否得到不同的结果,如果不需要 Soap12 功能,则保留它。可以找到更多详细信息here
关于c# - 服务引用问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24023324/