c# - 服务引用问题

标签 c# web-services wcf soap

我创建了控制台应用程序来使用 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/

相关文章:

c# - 语音识别项目

iOS客户端+Rest API上传照片

java - 使用所需网络适配器的 Web 服务调用

ajax - 如何在 fiddler 中放置多个断点?

c# - 枚举值未在生成的 wsdl 文件中正确显示。为什么?

c# - 如何为 TEX 创建解析器?

c# - 使用 MarshalByRefObject 进行奇怪的 .NET 远程处理 SerializationException

c# - 在C#/VB中,如何判断一个方法是正常声明还是扩展方法?

客户端上的 .NET 日志 Soap 请求

wcf - 如何覆盖 WebServiceHostFactory MaxReceivedMessageSize?